Created
May 22, 2022 15:44
-
-
Save DianGermishuizen/556a0821948b0d92ca4af7a9b515be54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Variable to hold the value we will filter on at runtime*/ | |
DECLARE @vCustomerID INT; | |
/*Variable to hold the query string we will alter at runtime then execute*/ | |
DECLARE @vSqlQuery VARCHAR(4000); | |
/*Define the base version of the query*/ | |
SET @vSqlQuery = ' | |
SELECT * | |
FROM [dbo].[Customers] | |
WHERE [Customers].[CustomerID] = ' + @vCustomerID + '' | |
/*Execute the code*/ | |
EXEC (@vSqlQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment