May 25, 2011 at 11:31 pm
HI All
I little bit confused regarding this issue i got... let us see the query first
SELECT
COLUMN1 AS COLUMN1,
COLUMN2 AS COLUMN2,
'' AS COLUMN3,
'' AS COLUMN4,
'' AS COLUMN5,
.
.
.
..
.
'' AS COLUMN-N,
FROM TABLE1
UNION
COLUMN1 AS COLUMN1,
COLUMN2 AS COLUMN2,
COLUMN3 AS COLUMN3,
COLUMN4 AS COLUMN4,
COLUMN5 AS COLUMN5,
.
.
.
..
.
COLUMN-N AS COLUMN-N,
FROM TABLE2
here i have a union query between two tables assume the result set having around 50 columns as output.but as union clause need both the table should have equal no of columns table1 have less no of column compare to table2 thus most of the column from table1 is needed to keep blank so will this query effects on performance or is it good practise to keep column black...
bec i know this column going to be blank before resultset is out and its more then 50column as result where around 40 column will be blank..
Let me know your opinion and let me know if u want more clearification
Thanks in advance
Syed Sami Ur Rehman
Creative Technosoft System
Hyderabad.
Syed Sami Ur Rehman
SQL-DBA
Creative Technosoft System | www.cts-in.com
May 26, 2011 at 2:57 am
hi:
i think it's the only choose to union two query result.it's not effects on performance.
if your query result is used by procedure,you can use two DataTable to receive two query result instead of using one DataTable.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply