Solved

Tsql select statement

Posted on 2011-02-10
3
460 Views
Last Modified: 2012-05-11
What does it mean when a select statement has a @?
for example

Select @column1, @column2
From table1
0
Comment
Question by:SPLady
3 Comments
 
LVL 4

Expert Comment

by:IceCode
ID: 34864509
"The @CustID means it's a parameter that you will supply a value for later in your code. This is the best way of protecting against SQL injection. Create your query using parameters, rather than concatenating strings and variables. The database engine puts the parameter value into where the placeholder is, and there is zero chance for SQL injection."

From

http://stackoverflow.com/questions/361747/what-does-the-symbol-do-in-sql
0
 
LVL 14

Expert Comment

by:leoahmad
ID: 34864517
An identifier beginning with the "at" sign denotes a local variable or parameter.
0
 
LVL 5

Accepted Solution

by:
skrga earned 125 total points
ID: 34864528
@ is defining a variable

eg.:

The following example returns the SIGN values of numbers from -1 to 1.

DECLARE @value real
SET @value = -1
WHILE @value < 2
   BEGIN
      SELECT SIGN(@value)
      SET NOCOUNT ON
      SELECT @value = @value + 1
      SET NOCOUNT OFF
   END
SET NOCOUNT OFF
GO

.. i think :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now