importing data into sql server which contains delimters

Soldato
Joined
18 Oct 2002
Posts
6,820
Hi guys,

I'm having trouble importing a field into SQL server because some of the data has a leading character of a square bracket "[". Is there anyway i can pull this information through without stripping it of the leading "["?

IE:

insert into table_abc (column_a) select fieldwhichcontainsirritatingcharacter from sourcetable

B@
 
The column name or the data has the bracket? Can you post a sample?

If the data has the bracket it should just work assuming column_a is the right data format.
 
Are you sure your destination column type isn't wrong?

This works fine in SQL Server:
PHP:
DECLARE @sourcetable TABLE (fieldwhichcontainsirritatingcharacter NVARCHAR(MAX))
INSERT INTO @sourcetable
	SELECT '[s1231312' UNION ALL
	SELECT '[12312312'

DECLARE @test TABLE (column_a NVARCHAR(MAX))
INSERT INTO @test (column_a)
	SELECT fieldwhichcontainsirritatingcharacter FROM @sourcetable

SELECT * FROM @test
 
Back
Top Bottom