set parameter sql server

Solutions on MaxInterview for set parameter sql server by the best coders in the world

showing results for - "set parameter sql server"
Dede
09 Oct 2016
1USE AdventureWorks2012;  
2GO  
3-- Passing values as constants.  
4EXEC dbo.uspGetWhereUsedProductID 819, '20050225';  
5GO  
6-- Passing values as variables.  
7DECLARE @ProductID int, @CheckDate datetime;  
8SET @ProductID = 819;  
9SET @CheckDate = '20050225';  
10EXEC dbo.uspGetWhereUsedProductID @ProductID, @CheckDate;  
11GO  
12-- Try to use a function as a parameter value.  
13-- This produces an error message.  
14EXEC dbo.uspGetWhereUsedProductID 819, GETDATE();  
15GO  
16-- Passing the function value as a variable.  
17DECLARE @CheckDate datetime;  
18SET @CheckDate = GETDATE();  
19EXEC dbo.uspGetWhereUsedProductID 819, @CheckDate;  
20GO  
21