Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
Manipulate String
Manipulate String
Rate Topic
Display Mode
Topic Options
Author
Message
JStevenson1
JStevenson1
Posted Wednesday, December 22, 2010 1:59 PM
Grasshopper
Group: General Forum Members
Last Login: Friday, April 05, 2013 2:15 PM
Points: 20,
Visits: 83
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?
Post #1038484
Lowell
Lowell
Posted Wednesday, December 22, 2010 2:22 PM
SSChampion
Group: General Forum Members
Last Login: Today @ 3:33 PM
Points: 11,648,
Visits: 27,768
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
--
There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1038503
Sean Lange
Sean Lange
Posted Wednesday, December 22, 2010 2:22 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 1:17 PM
Points: 8,641,
Visits: 8,273
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 Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1038504
Sean Lange
Sean Lange
Posted Wednesday, December 22, 2010 2:23 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Yesterday @ 1:17 PM
Points: 8,641,
Visits: 8,273
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 Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1038505
LutzM
LutzM
Posted Wednesday, December 22, 2010 2:23 PM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 3:17 PM
Points: 6,731,
Visits: 12,131
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
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question
How to post performance related questions
Links for
Tally Table
,
Cross Tabs
and
Dynamic Cross Tabs
,
Delimited Split Function
Post #1038506
JStevenson1
JStevenson1
Posted Wednesday, December 22, 2010 2:27 PM
Grasshopper
Group: General Forum Members
Last Login: Friday, April 05, 2013 2:15 PM
Points: 20,
Visits: 83
Worked. Thanks!
Post #1038509
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.