SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query for this sp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shanmugaraj
Posting Yak Master

219 Posts

Posted - 03/29/2013 :  06:58:17  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
kindly help on the query for this sp

CREATE PROCEDURE [dbo].[usp_pkg_audit_execute] (@execute_type char(3))
AS
BEGIN
If @execute_type ='PRE' then
INSERT INTO ssis_audit(package_name,status,start_time) VALUES(@package_name, '1',GETDATE())
SELECT @ssis_audit_id=CAST(SCOPE_IDENTITY() AS INT)
else if @execute_type ='POS' then
INSERT INTO ssis_audit(package_name,status,start_time) VALUES(@package_name, '2',GETDATE())
end if
END


THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

bandi
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 03/29/2013 :  07:12:57  Show Profile  Reply with Quote
What is the problem ? Where is the declaration for @package_name

I've fixed some typos......

1) Pass @package_name VARCHAR(10) as Input Param

2) If @execute_type ='PRE'
BEGIN
INSERT INTO ssis_audit(package_name,status,start_time) VALUES(@package_name, '1',GETDATE())
SELECT @ssis_audit_id=CAST(SCOPE_IDENTITY() AS INT)
END
else if @execute_type ='POS'
BEGIN
INSERT INTO ssis_audit(package_name,status,start_time) VALUES(@package_name, '2',GETDATE())
end
END
Go to Top of Page

shanmugaraj
Posting Yak Master

219 Posts

Posted - 03/29/2013 :  07:47:17  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
Thanks bandi
quote:
Originally posted by bandi

What is the problem ? Where is the declaration for @package_name

I've fixed some typos......

1) Pass @package_name VARCHAR(10) as Input Param

2) If @execute_type ='PRE'
BEGIN
INSERT INTO ssis_audit(package_name,status,start_time) VALUES(@package_name, '1',GETDATE())
SELECT @ssis_audit_id=CAST(SCOPE_IDENTITY() AS INT)
END
else if @execute_type ='POS'
BEGIN
INSERT INTO ssis_audit(package_name,status,start_time) VALUES(@package_name, '2',GETDATE())
end
END



THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 03/29/2013 :  08:05:14  Show Profile  Reply with Quote
quote:
Originally posted by shanmugaraj

Thanks bandi


Declare @ssis variable inside Procedure...

Welcome

--
Chandu

Edited by - bandi on 03/29/2013 08:06:36
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 03/29/2013 :  13:48:47  Show Profile  Reply with Quote
you dont need if ...else construct. just below would do

INSERT INTO ssis_audit(package_name,status,start_time)
SELECT @package_name,CASE @execute_type WHEN 'PRE' THEN '1' WHEN 'POS' THEN '2' END,GETDATE()


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000