Thursday, March 17, 2011

How to Declare Variables in MS-SQL Server Management Studio

Most of the projects I work on have some kind of database interaction and some of them require variables to be the passed to the queries at runtime.

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

-- Declare the variable you need
DECLARE @AcctNumber varchar;

-- Set the value of the variable
SET @AcctNumber = 1

-- Run the query testing the paramenters
select * from contacts
WHERE AccountNumber = @AcctNumber

Here is a screenshot of my test:

Pretty simple stuff yet useful...

Using SMS Channels with Oracle Intelligent Bots

Using SMS is a very convenient way to communicate with someone these days and most people prefer to use SMS instead of email. SMS also give...