on 2014 Aug 01 11:42 AM
hi.
i need a small information.
I Created a small table in Sql
ccode | varchar | no | 250 |
cname | varchar | no | 250 |
ctype | varchar | no | 250 |
---------------------------------------
My Stored Procedure at Sql
i am inserting values in to the temporary table by using below one after passing the parameter
i am executing the parameter is
EXEC 'cardcode' ,'cardname' ,'c'
if i execute the stored procedure in sql values are inserting same thing i want to do in sap b1 at query maanger
USE [WCTBRPLDB21-05-2014]
GO
/****** Object: StoredProcedure [dbo].[uspGetAddress1] Script Date: 8/1/2014 4:07:20 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[uspGetAddress1]
@Cuscode varchar(250),
@customertName VARCHAR(250) ,
@custype varchar(250)
As
Begin
DECLARE @Cur_Product CURSOR
set @Cur_Product= cursor for select CardCode,CardName,CardType from ocrd where CardCode =@Cuscode and CardName= @customertName and cardtype =@custype
open @Cur_Product
fetch next
from @Cur_Product into @Cuscode,@customertName,@custype
while @@FETCH_STATUS = 0
begin
insert into custupdate (ccode,cname,ctype) values (@Cuscode,@customertName,@custype)
fetch next
from @Cur_Product into @Cuscode,@customertName,@custype
end
close @Cur_Product
deallocate @Cur_Product
select * from custupdate
End
--------------------------
@Cuscode varchar(250),
@customertName VARCHAR(250) ,
@custype varchar(250),
select @Cuscode = T0.CARDCODE from OCRD T0 where T0.CARDCODE = '[%01]' AND
select @CARDNAME = T0.CARDNAME from OCRD T0 where T0.CARDNAME = '[%02]' AND
select @CARDTYPE = T0.CARDTYPE from OCRD T0 where T0.CARDTYPE = '[%03]'
uspGetAddress1 @Cuscode ,@CARDNAME ,@CARDTYPE
----------------------
The above one i pasted at query manager.
if i run it it is asking the parameters
but after execute it
i am getting the error that must declare the Scalar variable like that it is showing.
but i am all ready giving the scalar variable but it is not running.
Any information plz update me
is there any declaration problem in query manager.....................
Request clarification before answering.
Any Information plz update me..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try below in query generator:
Declare @Cuscode varchar(250),
Declare @customertName VARCHAR(250) ,
Declare @custype varchar(250)
/*SELECT FROM [dbo].[OCRD] T0*/
/* WHERE */
SET @Cuscode = /* T0.CardCode */ '[%0]'
/*SELECT FROM [dbo].[OCRD] T0*/
/* WHERE */
SET @customertName = /* T0.CardName */ '[%1]'
/*SELECT FROM [dbo].[OCRD] T0*/
/* WHERE */
SET @custype = /* T0.CardType */ '[%2]'
EXEC uspGetAddress1 @Cuscode,@customertName,@custype
**Don't remove comments
Thanks
Navneet
Hi,
Try this below and let me know your feedback,
Declare @Cuscode varchar(250)
Declare @customertName VARCHAR(250)
Declare @custype varchar(250)
set @Cuscode = (select T0.CARDCODE from OCRD T0 where T0.CARDCODE = '[%0]' )
set @customertName = (select T0.CARDNAME from OCRD T0 where T0.CARDNAME = '[%1]')
set @custype = (select max(T0.CARDTYPE) from OCRD T0 where T0.CARDTYPE = '[%3]')
EXEC uspGetAddress1 @Cuscode,@customertName,@custype
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.