Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
waleeed_mahmood
Creator
Creator

writing data through stored procedure in QS

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:

error.JPG

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

Labels (1)
1 Reply
waleeed_mahmood
Creator
Creator
Author

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.