Ask a Question related to Coldfusion Database Access, Design and Development.
-
awhitaker #1
Spaces in column value
I have a column table in which the values have spaces, i.e. "2005 CRA 696." In
my query, I want to account for various ways people may type that number into a
form, such as without any spaces - "2005CRA696" or with only "05CRA696." I
cannot modify the structure of the table. Any suggestions?
awhitaker Guest
-
Converting a 3 column pdf address list to a one column MS word doc
I need to convert a 3 col pdf into a manipulable text doc. Acrobat gives me lots of ways to do this in the normal program, but it doesn't preserve... -
Column chart need column to exceed axis maximum value
I need to figure out how to get a column in a columnchart to exceed the axis maximum or at least show at 100% height if it exceeds the axis maximum.... -
Move bound column to right of dynamic column in datagrid?
I have a datatable that I am binding to a C# ASP.NET 1.1 web page. I also want to put an "Edit" column on the datagrid. However, whenever I use... -
Convert an MS Access Yes/No column to a checkbox column in C# datagrid
Currently I have a datagrid displaying the multiple columns of data (text and numerical) found in a table in MS Access. In the Access table,... -
how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ?
I am new to ASP.NET. I am facing problem with datagrid. I will explain prob now. In the datagrid the first column is name in the second... -
Abinidi #2
Re: Spaces in column value
Its not good practice to have spaces in a column name. It is better to use underscores or not at all .
Abinidi Guest
-
paross1 #3
Re: Spaces in column value
In a query, you can rename the column with an alias without the spaces. Make
sure that you place the original column name within brackets (depending on your
database). Something like this:
SELECT [2005 CRA 696] AS 2005_CRA_696
FROM yourtable....
Phil
paross1 Guest
-
awhitaker #4
Re: Spaces in column value
Thanks for your help, but I must not have been clear on my problem. The column
name doesn't have a space - the values in the column have spaces, and I need to
match those against user input that may or may not contain the same spaces.
awhitaker Guest
-
Dan Bracuk #5
Re: Spaces in column value
Are the spaces always in the same place? If so, use string functions on your form variable to create a new variable in the expected format. Use that format in your query.
Dan Bracuk Guest
-
reenaroy #6
Re: Spaces in column value
Try to use this UDF for this purpose,
<cffunction name="getCorrectFormat" output="true" returntype="string"
access="public">
<cfargument name="str" type="any" required="true"/>
<cfset FirstFour=val(mid(str,1,4))>
<cfset FirstFourLen=len(FirstFour)>
<cfif FirstFourLen eq 1>
<cfset FirstFour="200" & FirstFour>
</cfif>
<cfset LastThree=right(str,3)>
<cfset newstr=trim(replacenocase(str,LastThree,"","all")) >
<cfset MiddelThree=right(newstr,3)>
<cfset correctformatStr=FirstFour & " " & MiddelThree & " " & LastThree>
<cfreturn correctformatStr>
</cffunction>
<cfset str="05CRA696">
<cfquery datasource="xyz" name=abc>
select * from tablename where columnname='#getCorrectFormat(str)#'
</cfquery>
reenaroy Guest
-
merrillaldrich #7
Re: Spaces in column value
Just strip all whitespace out of the input and the value(s) from the table and compare the results. You can use a replace function or regular expressions.
merrillaldrich Guest



Reply With Quote

