Pawel's profileOut of Space - Pawel Pot...PhotosBlogListsMore ![]() | Help |
|
August 20 UNION, EXCEPT, INTERSECT - best practiceIf you perform UNION, EXCEPT or INTERSECT statement it wolud be better to use parethesis to separate each SELECT statement to avoid bad results when you make a mistake in a keyword: SELECT TOP 1 name FROM sys.objects EXECPT SELECT TOP 1 name FROM sys.indexes What happens when you execute the code above? You will get two result sets because EXECPT will be treaten as a table alias. The remedy is: (SELECT TOP 1 name FROM sys.objects) EXECPT (SELECT TOP 1 name FROM sys.indexes) Putting SELECT statements into parenthesis will generate an error which is the correct result. You may also use some additional software to format your query before execution. For example Red Gate SQL Refactor will format the code in a different way if you have a mistake in a keyword. Credits to Maciej Pilecki who has called my attention to this problem. August 15 I've become a member of BAARFBecause of my experiences and feelings about RAID-Fs I've registered as a member of BAARF (Battle Against Any Raid F). It's a group of people sharing their dissaproval for using RAID-5 and other RAID-Fs for databases in a funny way :-) August 07 New article on Technet PolandThere is a new article about SQL Server 2005 on Technet Poland. Damian Widera writes on Performance Dashboard Reports (installing, using, customizing). Read more on Technet. Performance Dashboard Reports (part I) SQL Server 2008 July CTPThere is SQL Server 2008 July CTP available for download. The newest version of SQL Server 2008 comes with some interesting improvements and features (ORDPATH, Date/Time, Performance Data Collection and more). |
|
|