| Author |
Topic |
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-04-23 : 06:36:49
|
Hi,I have a string value that separated by dot character. And I have another two variables that I need to assignment left of string value to first variable and right part of dot character to second variable.Example:Declare @string varchar(20), @first varchar(15), @second varchar(15);Set @string = ‘left.right’;-- NEEDED STATEMNTSELECT @first, @second;--Result-- left right thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-23 : 06:40:36
|
| [code]SELECT @first=PARSENAME(@string,2),@second =PARSENAME(@string,1)SELECT @first, @second;[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-04-23 : 06:40:46
|
| set @first=parsename('left.right',2)set @second=parsename('left.right',1)Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-23 : 06:42:21
|
| Declare @string varchar(20), @first varchar(15), @second varchar(15);Set @string = 'left.right';-- NEEDED STATEMNTSELECT @first=SUBSTRING(@String,1,CHARINDEX('.',@string)-1), @second=SUBSTRING(@String,CHARINDEX('.',@string)+1,LEN(@string))select @first,@second MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-23 : 06:42:56
|
MadhivananFailing to plan is Planning to fail |
 |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-04-23 : 06:48:49
|
Thanks a lot.(Remember me? [NOT] EXISTS() ) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-23 : 06:52:09
|
quote: Originally posted by ms65g Thanks a lot.(Remember me? [NOT] EXISTS() )
Yes. Do you have any solution that invloves [NOT] EXISTS() Also now-a-days, you are not very active hereMadhivananFailing to plan is Planning to fail |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-04-23 : 07:45:13
|
| ms65g welcome back.Nowadays you hardly seem to be very active on this forum.So any particular reason for such a long break???PBUH |
 |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-04-23 : 08:55:05
|
| See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143434 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-04-23 : 09:39:18
|
quote: Originally posted by madhivanan
quote: Originally posted by ms65g See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143434
Dont stop replying just becuase someone finds mistakes in your codeYou will learn over the period of time MadhivananFailing to plan is Planning to fail
Now I will easily accept any advice. Your recommends help me to write queries and code very efficient. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-23 : 10:05:27
|
quote: Originally posted by ms65g
quote: Originally posted by madhivanan
quote: Originally posted by ms65g See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143434
Dont stop replying just becuase someone finds mistakes in your codeYou will learn over the period of time MadhivananFailing to plan is Planning to fail
Now I will easily accept any advice. Your recommends help me to write queries and code very efficient.
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|