Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 String ending with &

Author  Topic 

syedripon
Starting Member

9 Posts

Posted - 2005-09-29 : 23:12:58
Hi Kristen:

Thanks for your help in my date problem. It worked perfectly. I was away and could not answer back promptly.

yesterday, i was inserting data from a data file into a SQL table. 1 record had a name field as varchar. But it accidently, ended with a &.
For example, "New Construction &". when I am inserting, its taking all records except this record that ends with a &. Is there any way to include this one Or should I tell my client that this is an error.
If its an error, what is the expalnation(Like string char does not end with a & and & is a ------).
Thanks others in the forum.

Kristen
Test

22859 Posts

Posted - 2005-09-30 : 00:31:57
If you want to keep the "&" then put square brackets (well that's what we call them over this side of the pond!) around the column name:

SELECT [New Construction &] FROM MyTable

Or rename it:

EXEC sp_rename 'MyTable.[New Construction &]', 'New Construction', 'COLUMN'

"If its an error, what is the expalnation"

Column name contains a reserved character? Non-alphanumeric character?

Personally I'd get rid of the spaces in the column name too ...

I would use either

NewConstruction or New_Construction

Kristen
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-10-03 : 21:51:59
i think he's talking about the data

did you check the length of that field?

have you tried adding that record using query analyzer to see what error it generates if any?

--------------------
keeping it simple...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-03 : 23:30:00
"i think he's talking about the data"

Yeah, see: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55905

Kristen
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-10-03 : 23:44:45
yap, thanks for the link, double posters, tsk tsk tsk...


quote:
Originally posted by Kristen

"i think he's talking about the data"

Yeah, see: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55905

Kristen



--------------------
keeping it simple...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-03 : 23:56:19
"double posters"

Technically I think it was a "reply"

Kristen
Go to Top of Page
   

- Advertisement -