Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2008 > SQL Server 2008
|
SQL Server 2008 General discussion of SQL Server *2008* version only - not related to a specific book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2009, 02:42 PM
Authorized User
 
Join Date: Dec 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to devendar
Default SQL Server 2008 Query (comma separated)

CREATETABLE #Locations
(Name1 VARCHAR(100))
INSERTINTO #Locations values('Seattle,WA,ABC')
INSERTINTO #Locations values('Chicago,IL,XYZ')


But I want Output like this

City State Name
Seattle WA ABC
Chicago IL XYZ

Thanks in advance,
 
Old October 5th, 2009, 06:49 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Code:
CREATE TABLE #Locations
( 
    CityVARCHAR(100),
    State VARCHAR(2),
    Name VARCHAR(100)
)
INSERT INTO #Locations values('Seattle', 'WA', 'ABC')
INSERT INTO #Locations values('Chicago', 'IL', 'XYZ')
...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Comma Separated values aldwinenriquez SQL Server 2005 3 June 1st, 2007 08:52 PM
comma separated list MunishBhatia SQL Server 2000 11 March 21st, 2007 03:56 PM
Comma Separated Column Value thru T-SQL subhendude SQL Server 2000 2 December 12th, 2006 01:42 PM
Import a Comma separated txt file to SQL table arielote C# 2 April 17th, 2006 01:08 AM
Select Query for Comma separated IDs veeruu SQL Language 3 February 9th, 2006 03:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.