Answers for "parameters in sql"

SQL
1

set parameter sql server

USE AdventureWorks2012;  
GO  
-- Passing values as constants.  
EXEC dbo.uspGetWhereUsedProductID 819, '20050225';  
GO  
-- Passing values as variables.  
DECLARE @ProductID int, @CheckDate datetime;  
SET @ProductID = 819;  
SET @CheckDate = '20050225';  
EXEC dbo.uspGetWhereUsedProductID @ProductID, @CheckDate;  
GO  
-- Try to use a function as a parameter value.  
-- This produces an error message.  
EXEC dbo.uspGetWhereUsedProductID 819, GETDATE();  
GO  
-- Passing the function value as a variable.  
DECLARE @CheckDate datetime;  
SET @CheckDate = GETDATE();  
EXEC dbo.uspGetWhereUsedProductID 819, @CheckDate;  
GO
Posted by: Guest on June-24-2020
0

functions with parameters SQL

SET @OrderID = dbo.GetOrderID (default, default, default);
Posted by: Guest on July-15-2020
0

functions with parameters SQL

DECLARE
	@OrderID int = NULL,
	@OrderType int = 1,
	@Qty int = 2,
	@ServiceSpeed int = 3;

INSERT INTO OrdersTest (OrderType, Qty, ServiceSpeed)
	VALUES (@OrderType, @Qty, @ServiceSpeed);

EXEC @OrderID = dbo.GetOrderID
	@OrderType = @OrderType,
	@Qty = @Qty,
	@ServiceSpeed = @ServiceSpeed;

SELECT @OrderID 'Using EXEC Syntax';
Posted by: Guest on July-15-2020
0

functions with parameters SQL

EXEC @OrderID = dbo.GetOrderID
	@OrderType = @OrderType,
	@ServiceSpeed = @Qty,
	@Qty = @ServiceSpeed;
Posted by: Guest on July-15-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language