I typically test my queries against the database using Microsoft SQL Server Management Studio and being able to use variable on my queries there is a big help.
Here is a quick hint to use variables with MS-SQL Server Management Studio:
-- Database to use
USE OSBC;
-- Declare the variable you need
DECLARE @AcctNumber varchar;
-- Set the value of the variable
BEGIN
SET @AcctNumber = 1
END
-- Run the query testing the paramenters
select * from contacts
WHERE AccountNumber = @AcctNumber
Here is a screenshot of my test:
Pretty simple stuff yet useful...