<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; T-SQL Script to Devide One Column into Two Column</title>
	<atom:link href="http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/</link>
	<description>Notes of a SQL Server MVP and Database Administrator</description>
	<lastBuildDate>Sat, 21 Nov 2009 05:54:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Vineesh</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-55040</link>
		<dc:creator>Vineesh</dc:creator>
		<pubDate>Thu, 20 Aug 2009 02:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-55040</guid>
		<description>I need to create add some values in table. where only column value is going to be changed . is there a way to add multiple rows in single oracle statment

for an instance I have table like 

Company ,Area, EmployeeNo

In this table company and area field is going to be same and only employee No is going tobe changed and I have employee no in the below format

1234,4567,7890

and I am expexting an out put as below


Company  Area  Employee No

Abc       US     1234
Abc       US     4567
Abc       US     7890

is there a way to execute in single statment.</description>
		<content:encoded><![CDATA[<p>I need to create add some values in table. where only column value is going to be changed . is there a way to add multiple rows in single oracle statment</p>
<p>for an instance I have table like </p>
<p>Company ,Area, EmployeeNo</p>
<p>In this table company and area field is going to be same and only employee No is going tobe changed and I have employee no in the below format</p>
<p>1234,4567,7890</p>
<p>and I am expexting an out put as below</p>
<p>Company  Area  Employee No</p>
<p>Abc       US     1234<br />
Abc       US     4567<br />
Abc       US     7890</p>
<p>is there a way to execute in single statment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-54683</link>
		<dc:creator>Brian Tkatch</dc:creator>
		<pubDate>Mon, 10 Aug 2009 12:08:37 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-54683</guid>
		<description>@prasad

 The clearest solution is to use a CASE statement.

WITH
	Data(id, isnormal)
AS
	(
	 SELECT 1, 0 UNION ALL
	 SELECT 2, 0 UNION ALL
	 SELECT 3, 0 UNION ALL
	 SELECT 4, 1 UNION ALL
	 SELECT 5, 1 UNION ALL
	 SELECT 6, 0 UNION ALL
	 SELECT 7, 1
	)
SELECT
		Id,
		IsNormal,
		CASE IsNormal
		 WHEN 0 THEN 1
		 ELSE 0
		END Abnormal
FROM
		Data;

Though, a mathematical solution could also be used, but not be as clear. Here is one:  (IsNormal + 1) % 2</description>
		<content:encoded><![CDATA[<p>@prasad</p>
<p> The clearest solution is to use a CASE statement.</p>
<p>WITH<br />
	Data(id, isnormal)<br />
AS<br />
	(<br />
	 SELECT 1, 0 UNION ALL<br />
	 SELECT 2, 0 UNION ALL<br />
	 SELECT 3, 0 UNION ALL<br />
	 SELECT 4, 1 UNION ALL<br />
	 SELECT 5, 1 UNION ALL<br />
	 SELECT 6, 0 UNION ALL<br />
	 SELECT 7, 1<br />
	)<br />
SELECT<br />
		Id,<br />
		IsNormal,<br />
		CASE IsNormal<br />
		 WHEN 0 THEN 1<br />
		 ELSE 0<br />
		END Abnormal<br />
FROM<br />
		Data;</p>
<p>Though, a mathematical solution could also be used, but not be as clear. Here is one:  (IsNormal + 1) % 2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prasad</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-54641</link>
		<dc:creator>prasad</dc:creator>
		<pubDate>Sun, 09 Aug 2009 11:26:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-54641</guid>
		<description>hi friends,

i have one table is normal column is bit

id  isnormal  

1     0
2     0
3     0
4     1
5     1
6     0
7     1

i wnat oput put like this

id    normal   abnormal
1      0             1
2      0             1
3      0             1
4      1             0
5      1             0
6      0             1
7      1             0

note:--where isnormal is 0 that time i wnat to display 1 in abnormal column
where isnormal is 1 that time i wnat to display 1 in normal column
first i want to divide is normal column into two columns one is
norman
second one is
abnormal

please help me it&#039;s very urgent in my project

Thanks &amp; Regards&#039;
PrasadGopathi</description>
		<content:encoded><![CDATA[<p>hi friends,</p>
<p>i have one table is normal column is bit</p>
<p>id  isnormal  </p>
<p>1     0<br />
2     0<br />
3     0<br />
4     1<br />
5     1<br />
6     0<br />
7     1</p>
<p>i wnat oput put like this</p>
<p>id    normal   abnormal<br />
1      0             1<br />
2      0             1<br />
3      0             1<br />
4      1             0<br />
5      1             0<br />
6      0             1<br />
7      1             0</p>
<p>note:&#8211;where isnormal is 0 that time i wnat to display 1 in abnormal column<br />
where isnormal is 1 that time i wnat to display 1 in normal column<br />
first i want to divide is normal column into two columns one is<br />
norman<br />
second one is<br />
abnormal</p>
<p>please help me it&#8217;s very urgent in my project</p>
<p>Thanks &amp; Regards&#8217;<br />
PrasadGopathi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-53779</link>
		<dc:creator>Imran Mohammed</dc:creator>
		<pubDate>Fri, 17 Jul 2009 04:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-53779</guid>
		<description>@Eibhlin

This could be easily implemented. 

I do have a question, lets look an example. 

This is your format, 

Apt NO, Building NO, Street Address, City Name, State, Zipcode

Ex: Apt #14,5233,Niagara falls,NewYork City, New York,12345

If format is like above, There is no issue, I can easily place all the 6 values in 6 different columns, but what if we get this value, 

5233,Niagara falls,NewYork City, New York,12345

How I am I Suppose to know ? that there is no Apt No in above example, I might start putting values in wrong column ? 

How do you deal with this, Like if you dont have any value, do you display it as empty, like this, 

 ,5233,Niagara falls,NewYork City, New York,12345


Solution : 
Check this link :

http://dhameliya.blogspot.com/2009/04/how-to-split-comma-separated-string-in.html

~ IM.</description>
		<content:encoded><![CDATA[<p>@Eibhlin</p>
<p>This could be easily implemented. </p>
<p>I do have a question, lets look an example. </p>
<p>This is your format, </p>
<p>Apt NO, Building NO, Street Address, City Name, State, Zipcode</p>
<p>Ex: Apt #14,5233,Niagara falls,NewYork City, New York,12345</p>
<p>If format is like above, There is no issue, I can easily place all the 6 values in 6 different columns, but what if we get this value, </p>
<p>5233,Niagara falls,NewYork City, New York,12345</p>
<p>How I am I Suppose to know ? that there is no Apt No in above example, I might start putting values in wrong column ? </p>
<p>How do you deal with this, Like if you dont have any value, do you display it as empty, like this, </p>
<p> ,5233,Niagara falls,NewYork City, New York,12345</p>
<p>Solution :<br />
Check this link :</p>
<p><a href="http://dhameliya.blogspot.com/2009/04/how-to-split-comma-separated-string-in.html" rel="nofollow">http://dhameliya.blogspot.com/2009/04/how-to-split-comma-separated-string-in.html</a></p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eibhlin</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-53755</link>
		<dc:creator>Eibhlin</dc:creator>
		<pubDate>Thu, 16 Jul 2009 10:52:21 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-53755</guid>
		<description>Hea thanks a million love your site. 
What do you do with this query if you have more then two colunms of data though?&gt;

I&#039;m trying to implement this when using address. 
So i never know how many rows would be needed. but 
say could have 4 or 5 or 6 bits of data seperated by each coma that i would like to see in one cell. 
&#039;No 10, Drumhaughley, Killoe, Co. Longford&#039; For example?

thanks</description>
		<content:encoded><![CDATA[<p>Hea thanks a million love your site.<br />
What do you do with this query if you have more then two colunms of data though?&gt;</p>
<p>I&#8217;m trying to implement this when using address.<br />
So i never know how many rows would be needed. but<br />
say could have 4 or 5 or 6 bits of data seperated by each coma that i would like to see in one cell.<br />
&#8216;No 10, Drumhaughley, Killoe, Co. Longford&#8217; For example?</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lakshmi</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-43579</link>
		<dc:creator>Lakshmi</dc:creator>
		<pubDate>Tue, 07 Oct 2008 19:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-43579</guid>
		<description>Hi,
good demo of CHARINDEX.

I want to add a column &#039;DEPT&#039; after &#039;EMP_NAME&#039; column before &#039;PAY_SCALE&#039; in EMP_Demo table.

I want to add it using SQL statement in 2005.

how to do it?
Thanks a lot in advance.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
good demo of CHARINDEX.</p>
<p>I want to add a column &#8216;DEPT&#8217; after &#8216;EMP_NAME&#8217; column before &#8216;PAY_SCALE&#8217; in EMP_Demo table.</p>
<p>I want to add it using SQL statement in 2005.</p>
<p>how to do it?<br />
Thanks a lot in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cell phone reviews</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-43364</link>
		<dc:creator>cell phone reviews</dc:creator>
		<pubDate>Mon, 29 Sep 2008 08:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-43364</guid>
		<description>It is good...
here CHARINDEX is just counting the position of the  field. And thus creating the whole formula to provide the solution..

Good job Pinal</description>
		<content:encoded><![CDATA[<p>It is good&#8230;<br />
here CHARINDEX is just counting the position of the  field. And thus creating the whole formula to provide the solution..</p>
<p>Good job Pinal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CC</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-40407</link>
		<dc:creator>CC</dc:creator>
		<pubDate>Fri, 18 Jul 2008 01:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-40407</guid>
		<description>is there any way that able to do this?
i mean within the select statement.</description>
		<content:encoded><![CDATA[<p>is there any way that able to do this?<br />
i mean within the select statement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asim</title>
		<link>http://blog.sqlauthority.com/2008/05/25/sql-server-t-sql-script-to-devide-one-column-into-two-column/#comment-39712</link>
		<dc:creator>Asim</dc:creator>
		<pubDate>Thu, 03 Jul 2008 03:26:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=615#comment-39712</guid>
		<description>Great job, i am learning the sql server and a big fan of the person who are doing good job in the programming field</description>
		<content:encoded><![CDATA[<p>Great job, i am learning the sql server and a big fan of the person who are doing good job in the programming field</p>
]]></content:encoded>
	</item>
</channel>
</rss>
