June 7, 2007 at 11:26 am
What is a good way to parse a string of data coming in from an outside source...?
lets say the string will be 25,000 characters
ie:: (bad way)
alter
proc [dbo].[set__]
@input0 varchar
(8000),
@input1 varchar
(8000),
@input2 varchar
(8000),
@input3 varchar
(8000),
@input4 varchar
(8000),
@input5 varchar
(8000)
as
declare @input varchar(8000)
declare @inputC int
set
@inputC=-1
nextinput
:
set @inputC=@inputC+1
if(@inputC=0)set @input=@input0
else if(@inputC=1)set @input=@input1
else if(@inputC=2)set @input=@input2
else if(@inputC=3)set @input=@input3
else if(@inputC=4)set @input=@input4
else if(@inputC=5)set @input=@input5
else
return
--do stuff here..
goto nextinput
June 7, 2007 at 11:51 am
Wouldn't VARCHAR(MAX) do the trick?
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgJune 7, 2007 at 12:01 pm
thanks,
I looked it up, and max is only for 2005 (I'm using 2000).
I can use text type instead.
Would it be better to execute the input from a file or via the string?
June 7, 2007 at 12:07 pm
OK, this is the 2005 forum, that's why I thought you had it.
As far as the file or string question....I don't know, but I'm someone else will answer that one...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgJune 7, 2007 at 4:39 pm
It depends... what kind of string is it??? CSV, Fixed Field, XML, Quoted CSV, or ????
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply