December 22, 2010 at 1:59 pm
I have several value in a column called test.
Select Statement: Select Test From Abc
Output: JonDoe
Desired Output: 'JonDoe'
How do I achieve desired output?
December 22, 2010 at 2:22 pm
JStevenson1 (12/22/2010)
I have several value in a column called test.Select Statement: Select Test From Abc
Output: JonDoe
Desired Output: 'JonDoe'
How do I achieve desired output?
so the only difference is you want single quotes around the field, right?
this is pretty straight forward, what have you tried so far?
I hate to give it away in case this is a homework question, so let me give some hints first:
are you familiar with how to concatenate strings together in a select statement?
Lowell
December 22, 2010 at 2:22 pm
JStevenson1 (12/22/2010)
I have several value in a column called test.Select Statement: Select Test From Abc
Output: JonDoe
Desired Output: 'JonDoe'
How do I achieve desired output?
Are you wanting to add the single quote around the field?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 22, 2010 at 2:23 pm
JINX! I too assumed this to be homework. 😉
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 22, 2010 at 2:23 pm
JStevenson1 (12/22/2010)
I have several value in a column called test.Select Statement: Select Test From Abc
Output: JonDoe
Desired Output: 'JonDoe'
How do I achieve desired output?
Something like the following code? (assuming all you want to do is add the quotation marks...)
Select ''''+Test +'''' From Abc
December 22, 2010 at 2:27 pm
Worked. Thanks!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply