Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have two questions about stored procedures. Its my first time calling a Stored procedure from QS. I have set it up in SQLMS and tested it in the server. it works fine.
Q1:
The stored Prcodure is used to inset data into the table. I call it from QS as follows:
SQL exec dbo.testSP(5);
OR //tried both ways still getting the same error.
SQL exec "DBName".dbo.testSP(5);
My SP accepts a parameter of type int and is defined as follows:
Create PROCEDURE [dbo].[testSP]
@SN int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
insert into dbo.test([Sort Number])
Values(@SN)
END
When i run this from QS, i get the following error:
Could someone please tell me what im missing so i can fix it?
Q2:
I have a table (lets call it Table A) in QS with few rows, is it possible to insert all the rows in Table A to a table in SQLMS using a stored procedure?
how do you reference the values in the table? if someone could provide me with an example, i'd really really appreciate it.
Thank you,
Waleed
For those wondering for the solution to the first question, the brackets are [] and not (). It worked for me. If someone could please shed some light on the second question, id really appreciate it.
i thought of using loops but loops in QS can be really slow. so is there a faster way?
Thanks.