Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
filipecorreia
Starting Member
3 Posts |
Posted - 2004-04-23 : 05:32:36
|
| I have a table named adsl_dslam that have one column with the name id_dslam.why I get this error:Server: Msg 170, Level 15, State 1, Line 1Line 1: Incorrect syntax near ')'.when I run the query: select id_dslam from (select * from adsl_dslam)this is a simple example so please don't reply saying that I can get the same result just doing select id_dslam from adsl_dslam. If I understand the problem in the simple one I can make the more complex queries work.thank you |
|
|
LarsG
Constraint Violating Yak Guru
284 Posts |
Posted - 2004-04-23 : 05:42:48
|
| [code]select id_dslam from (select * from adsl_dslam) dt[/code] |
 |
|
|
filipecorreia
Starting Member
3 Posts |
Posted - 2004-04-23 : 06:00:17
|
It worked, can you explain what means the "dt" in the endquote: Originally posted by LarsG
select id_dslam from (select * from adsl_dslam) dt
|
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-04-23 : 06:48:58
|
| It's an alias for the 'derived table' resulting from the inner query....the alias can be anything 'a','b','c','tablea','mytable'....etc...basically it's a requirement of the syntax for this type of statement to work.But...it also correlates with the 'convention' that can be used elsewhere in SQL statements for assigning 'short aliases' to 'long table names'....(mainly) for legibility reasons. |
 |
|
|
|
|
|