Results 1 to 4 of 4

Thread: How to embed quotes in t-sql

  1. #1
    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.

  2. #2
    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.

  3. #3
    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.

  4. #4
    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.

Similar Threads

  1. Need help with Morningstar Quotes for Firefox 5
    By Merka in forum Technology & Internet
    Replies: 5
    Last Post: 27-06-2011, 10:28 PM
  2. What are your Favorite Quotes From Portal 2
    By Nancie in forum Video Games
    Replies: 6
    Last Post: 24-05-2011, 07:13 PM
  3. What are Magic Quotes in PHP?
    By Rob Dizzle in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 12:33 AM
  4. Regex string with quotes
    By Gunner 1 in forum Software Development
    Replies: 5
    Last Post: 07-02-2010, 06:03 AM
  5. SED with quotes
    By GlassFish in forum Software Development
    Replies: 5
    Last Post: 25-12-2009, 02:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,506,771.78600 seconds with 17 queries