Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 03-08-2009
Member
 
Join Date: Apr 2009
Posts: 67
How to embed quotes in t-sql

I have copied some text to Notepad file and found that it has comma-delimited, file with the double quote (") is used as the text qualifier. I also had an little vbscript that uses the FSO to write a T-SQL text file to a folder. import this file into a table using SQL Server 2005, so I am using SSIS. However, there are 2 columns in this file which have embedded in its text, quotes, of all characters. Now my requirement is that it should allowed me to embed quotes to the sql statement.
Reply With Quote
  #2  
Old 03-08-2009
Member
 
Join Date: Dec 2008
Posts: 161
Re: How to embed quotes in t-sql

If you're doing string manipulation in T-SQL, you'll frequently stumble upon tasks that require you to embed single quotes in your queries. Single quotes poses a problem when building SQL on the fly in TSQL scripts. The problem is, the single quote is what is used to enclose strings in T-SQL. This is because single quotes are used to enclose strings in TSQL.
Reply With Quote
  #3  
Old 03-08-2009
Member
 
Join Date: Oct 2008
Posts: 117
Re: How to embed quotes in t-sql

The Windows Script Host (WSH) runtime engine reads a script's command-line arguments and makes them accessible in the WshArguments object and its associated collections. A concatenation operator to separate the first part of the sentence and the one that comes after the single-quote and the use of a two-single quote approach.
Reply With Quote
  #4  
Old 03-08-2009
Member
 
Join Date: Mar 2008
Posts: 258
Re: How to embed quotes in t-sql

SSIS is choking on the embedded quotes. Is there ANY way around this? This seems like it should be a bug in SSIS. Two single quotes look like a double quote. And if you have double quotes in your sql, it will be very confusing. I could swear that I used to be able to do this with DTS and in Excel and Access too. This simpy means that every time you have a single-quote character included in your string, you have to do string concatenation to accomodate the insertion of a single-qoute in your string.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to embed quotes in t-sql"
Thread Thread Starter Forum Replies Last Post
Need help with Morningstar Quotes for Firefox 5 Merka Technology & Internet 5 27-06-2011 10:28 PM
What are your Favorite Quotes From Portal 2 Nancie Video Games 6 24-05-2011 07:13 PM
What are Magic Quotes in PHP? Rob Dizzle Software Development 5 05-03-2010 12:33 AM
Regex string with quotes Gunner 1 Software Development 5 07-02-2010 06:03 AM
SED with quotes GlassFish Software Development 5 25-12-2009 02:40 PM


All times are GMT +5.5. The time now is 01:24 AM.