Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parse a string in a SPROC

Status
Not open for further replies.

jhall01

Programmer
Jul 3, 2003
328
US
I have a text file that loads up on a coldfusion webserver which my Database can't see. I pase the contents to a variable in Coldfusion and then pass the variable to a Stored Procedure.

I have the string passing correctly but I need to parse it within a Stored Procedure! any ideas.

The string is a comma delimited text file with 7 columns and double quote text qualifier.

I have done string parsing quite often but never in a Stored Procedure. What are some good function to use to parse?

Thanks,

Jon

 
A while loop and CHARINDEX and LEFT, or SUBSTRING should do what you need. Take a look at Books Online.

TR
 
Okay then how do i find a carriage return (newline) from a string in a stored procedure:

@filetext =

'111,222,333,444
111,333,444,555'

Select @carriageposition = charindex(@filetext,'-----')

what should go in the '-----'

I have tried \n \\n char(10) and chr(10)

any ideas?

 
Select @carriageposition = charindex(char(10),@filetext)

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top