mercredi 3 décembre 2014

must declare scalar variable for @User_Id and for Activity


Vote count:

0




while i am execution the following procedure i am getting the errors like 'Must declare the scalar variable "@USer_Id".' and 'Must declare the scalar variable "@Activity".' can anybody help me how to over come the error here the view creation is mandatory and the conditions are initially the view table data should be retrived based upon the User_Id,given Timestamp rage i.e. start_time and end_time parameters and after getting the result, we have get the data based upon the Activity the code is here which i wrote



create procedure Proc1 @User_Id varchar(50),@start_time bigint,
@end_time bigint,
@view_name varchar(50),
@Activity varchar(30)
as begin
exec('create view view_name
as select Asset_Id ,Activity,User_Id,
Event_Description, Timestamp from
(
SELECT [j30c_editorial_id] AS Asset_Id
,[j30c_action] As Activity
,[j30c_description] As Event_Description
,[j30c_user_name] As User_Id
,[j30c_date] As Timestamp
FROM [sandboxmbdb].[dbo].[j30t_changelog]

UNION ALL

SELECT [Asset_Id],
[j30c_action],
[Event_Type_Desc],
[User_Id],
[Timestamp]
FROM [refauditdatabase].[dbo].[AS_Event_Tracker_T] a,
[refauditdatabase].[dbo].[AS_Event_Type_M] b WHERE
a.[Event_Type_Id]=b.[Event_Type_Id])aa
where User_Id=@User_Id and Timestamp between @start_time and @end_time
and view_name=@view_name ')
exec('select * from view_name where Activity=@Activity and
view_name=@view_name')
end


asked 1 min ago







must declare scalar variable for @User_Id and for Activity

Aucun commentaire:

Enregistrer un commentaire