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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 need some help

Author  Topic 

shubhada
Posting Yak Master

117 Posts

Posted - 2007-03-21 : 08:18:57
I have one string as follow

[rule("Total Covered Days",["Covered Days","Process Rule"],["",""]),rule("Flat Rate",["Reimburse Amt","Flat Rate","Process Rule"],["","2",""])

I have stored this string in one variable.

I want to break this string with "rule" and want to insert into temp table tempList.
like as follow

here key is IDENTITY column.

key List
1 [rule("Total Covered Days",["Covered Days","Process Rule"],["",""])
2 rule("Flat Rate",["Reimburse Amt","Flat Rate","Process Rule"],["","2",""])

I am using following code but it not working.

select @List

select @count = len(@List1)

select @count

while (@count1 <= @count)

begin

select @List2 = SUBSTRING (@List1,1,CHARINDEX(',rule',@List1,1)-1)
Insert Into tempList values (@List2)
select @List1 = rtrim(ltrim(replace(@List1,@List2,'')))
select @count1 = len(@List1)
select @count1

end



plz tell me how i can break this string and insert into table.

X002548
Not Just a Number

15586 Posts

Posted - 2007-03-21 : 09:56:11
You're gonna have to tell us what is to be inserted, i.e., what's the delimiter, and what does the table look like?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

shubhada
Posting Yak Master

117 Posts

Posted - 2007-03-21 : 13:37:02
I want to insert the string start from "rule" ,
and delimiter should be ,rule.
but first charater in the string is [rule so the first record will inserted as it is.but after that i will select the string from ",rule"
first string is
[rule("Total Covered Days",["Covered Days","Process Rule"],["",""])
and second string will be
rule("Flat Rate",["Reimburse Amt","Flat Rate","Process Rule"],["","2",""])




SQLTeam
Go to Top of Page
   

- Advertisement -