Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 While problem

Author  Topic 

wormz666
Posting Yak Master

110 Posts

Posted - 2008-11-03 : 03:40:08
declare @param varchar(100)
declare @pcount numeric(18,0)
declare @dum numeric(18,0)
declare @dummy varchar(100)
declare @gui varchar(100)
set @param = 'wewee,wewew,wewewe,'
set @pcount = len(@param)
set @dum = 1
while (@pcount !=@dum)
begin
if substring(@param,@dum,1) != ','
begin
set @dummy = @dummy + substring(@param,@dum,1)
continue
end
continue
end


please help me....

i want to make a dynamic insert in the stored procedure,i want to separate the value the i send.....

please help...

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-03 : 03:47:08
just use Parsevalues function given below

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=113563&SearchTerms=parsevalues

and use it as follows

SELECT Val FROM dbo.ParseValues(@param ,',')t
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-11-03 : 03:48:37
but i want to all of the object in my table....
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-11-03 : 03:55:49
the comma sign there indicates the number of column will be use...................
i want to separated each to the values.............
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-03 : 03:57:04
Search for Split function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-11-03 : 04:00:25
i search it on the books online but there are no split function..
im using ms sql server 2000








Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-03 : 04:04:37
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-03 : 04:09:16
it will split the comma seperated value to individual value.see below

declare @param varchar(100)

set @param = 'wewee,wewew,wewewe,reg,ewrgtr5,dfbtyb6u7j7,rbhy6jhu6j,rtby6bhy64nu6,scr4g5tgh5yh67j'

select * from dbo.ParseValues(@param,',')t



output
------------------------------------
ID Val
----------- ----------------------------
1 wewee
2 wewew
3 wewewe
4 reg
5 ewrgtr5
6 dfbtyb6u7j7
7 rbhy6jhu6j
8 rtby6bhy64nu6
9 scr4g5tgh5yh67j
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-11-03 : 04:11:42
thank you for the info.....ill try it at home

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-03 : 04:17:43
quote:
Originally posted by wormz666

thank you for the info.....ill try it at home




ok. try and let us know how you got on...
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-11-03 : 04:26:54
will i create a function or its is existing on the ms sql server 2000??........
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-03 : 04:42:31
quote:
Originally posted by wormz666

will i create a function or its is existing on the ms sql server 2000??........


You have to create

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -