|
Mailing Lists
|
Home /
Groups /
SQL
at sign in sql select statement
I'm looking at a query in someones code and it has something that is unfamiliar to me. The select statement has:Michael Dinowitz 06/13/11 01:09 P Never seen @ in a table name either, dunno what that might mean.Peter Boughton 06/13/11 01:19 P just a guess, but could @name be a machine name? saying the table is on machine reliant?George Gallen 06/13/11 02:01 P @tablename is a table variable in SQL Server but it usually has to beMaureen 06/13/11 02:20 P The numbers in the ORDER statement are the cardinal positions of the columns in the SELECT statement required for ORDER.Adrian J. Moreno 06/13/11 02:27 P Maureen <mamamaureen@gmail.com> wrote:Perez, Percy 06/13/11 02:24 P I'm looking at a query in someones code and it has something that is unfamiliar to me. The select statement has: FROM dbo.Person@Reliance What is the @ sign? Neither Person nor Reliance are tables in the database. Also, there is an Order By that just has numbers, no fields to sort by: ORDER BY 8,9,6 Can anyone educate me on this? Thanks Never seen @ in a table name either, dunno what that might mean. However, the numbers in ORDER BY relate to the columns in the SELECT part: SELECT id,name,email ... ORDER BY 3,2 ...is equivalent to... SELECT id,name,email ... ORDER BY email,name You can also use numbers in GROUP BY in the same way. Useful when you want to avoid repeating a bunch of column names ... though less helpful when you've got nine (or more) columns and you're ordering like they are in your example. just a guess, but could @name be a machine name? saying the table is on machine reliant? George ----- Excess quoted text cut - see Original Post for more ----- @tablename is a table variable in SQL Server but it usually has to be declared before being used. What database are you using? ----- Excess quoted text cut - see Original Post for more ----- The numbers in the ORDER statement are the cardinal positions of the columns in the SELECT statement required for ORDER. Have you checked if there is a View named "Person@Reliance"? Adrian J. Moreno I Know Kung Foo Consulting (214) 280-6676 http://iknowkungfoo.com http://twitter.com/iknowkungfoo Sent from my iPad On Jun 13, 2011, at 12:08 PM, Michael Dinowitz <mdinowit@houseoffusion.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- Maureen <mamamaureen@gmail.com> wrote: @tablename is a table variable in SQL Server but it usually has to be declared before being used. What database are you using? ----- Excess quoted text cut - see Original Post for more -----
|
May 20, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||