SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sql server query


sql server query

Author
Message
asranantha
asranantha
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1300 Visits: 4717
hi friend i have small doubt in sql .plese tell me how to solve

table data contains like below


col
10
abc
jai
20
21
kali
23
ravi
28
kum
lan
balu
31


based on this table i want separte numbers and string values
output like

Col Col1 Col2
10 10
Abc . abc
Jai . jai
20 20 .
21 21 .
Kali . kali
23 23 .
Ravi . Ravi
28 28 .
Kum . Kum
Jan . Jan
Lan . Lan
balu . Balu
31 31 .


plese tell me how to wirte query to solve this issue in sql server.
J Livingston SQL
J Livingston SQL
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15365 Visits: 38735
this article may help you

http://www.sqlservercentral.com/articles/IsNumeric/71512/




SELECT col,
case when col NOT LIKE '%[^0-9]%' then col else '' end,
case when col LIKE '%[^0-9]%' then col else '' end
FROM <YOURTABLE>




________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search