Solved

Tsql select statement

Posted on 2011-02-10
3
463 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

13 Experts available now in Live!

Get 1:1 Help Now