SQLTeam.com | Weblogs | Forums

Single parameter in sp with values fron an excel file - execution of sp


#1

Hello
I need urgently your help. I have a stored procedure with 1 single parameter (@code)
e.g create PROCEDURE george
@code int
begin
...........

the send me an excel which has the codes ( for @code) that i must to execute
e.g excel has 1 column (code) and 3 rows (1111, 2222,3333)

the problem is when i am going to execute it i have to give
EXEC george @code = '1111'
EXEC george @code = '2222'
EXEC george @code = '3333'
in order to execute ( in series). but when the excel file have 100 rows this is a problem

could you tell a way ( to write different maybe the procedure or something else) so that i have to give only ONCE execution for the procedure and this executes all the codes from the excel (( in series) one after the other.
thanks in advance


#2

pass the values as a comma-separated list (e.g. '111,222,333') then use the splitter function to get them out;

splitter

There are great examples in there


#3

thanks
can you explain me about the splitter because i can not know which method i have to use
except this , is there an alternative way


#4

did you read the article and try out the examples? It really is the best way


#5

ok . i am going to read it carefully. thank you for the quick response