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
 Automatically Add Text?

Author  Topic 

theHydra
Starting Member

42 Posts

Posted - 2011-09-12 : 16:47:20
Hi all,

I have some data from an Excel doc that I need to use for SQL query. I have some fields in Excel that I want to use in my where statement.

For example, I would like to add the ' at the beginning and end of the text.

The text coming out of Excel looks like:

000-000003-0001
000-000017-0001
000-000024-0001
000-000024-0002
001-000009-0000
001-000009-0047
001-000009-0051
001-000009-0054
001-000009-0059
001-000009-0063
001-000009-0071
001-000009-0078
001-000009-0081
001-000009-0095
001-000009-0097
001-000012-0000
001-000012-0007
001-000012-0024

Any ideas are greatly appreciated.

memorykills
Starting Member

18 Posts

Posted - 2011-09-12 : 16:49:41
in excel, add a new column with formula =CONCATENATE("'", $A2,"'") ?
Go to Top of Page

theHydra
Starting Member

42 Posts

Posted - 2011-09-12 : 17:04:16
oh snap, i forgot about CONCATENATE

thanks memorykills!!
Go to Top of Page
   

- Advertisement -