General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Using * in sqlselect
I wonder whats best, to specify every field in an sqlselect, or use a * (a "star", I dont know the english word).
Example:
I make a select and join 2 tables. Table 1 has 40 fields and table 2 has 40 fields. I need 35 fields from each table. (I send the select command to a SQL2000 server)
Is it better to fetch ALL fields with a select like this:
select * from table1,table2,...
Or like this
select table1.*,table2.*,...
Or should I specify every field one by one like this:
select table1.field1,table2.field1,table2.field2,...
If I use a ' * ' I get more fields than I want. In this example I get 5 fields from each table that I can ignore in the result. But I am willing to sacrifice that because its easier to write and shorter.
Or are there some rule that says that I always schould specify every field. The select command can be VERY long i this case.
Of course I specify the fields if I only need a few fields from the tables, but my wondering is when I want almost every fields (can be more than 100).
I hope you understand my question.
Thankyou
/Kjell
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only