I wouldnt get into the habit of doing that though. On a complex statement it will take a fair bit of time to analyze the query and build the plan. If you use sp_executesql then SQL Server will cache the plan associated with that statement.
Dave B
Posts
-
Conditional Index Usage -
SQL InjectionThis Page http://www.sommarskog.se/dynamic_sql.html[^] Contains a lot of info about sql injection
-
Conditional Index UsageProbably best to use dynamic sql but read this first http://www.sommarskog.se/dynamic\_sql.html
-
Count of non null columns in a rowIts Not pretty but...
select case when _cola_ is null then 1 else 0 end+ case when _colb_ is null then 1 else 0 end+ ................... from _table_
modified on Friday, January 11, 2008 3:53:29 AM
-
Gig of the YearI saw them at Wembley Last Year... They are just amazing live.. goto www.muse.mu for presales
-
Gig of the YearMuse .. Earls Court .. Dec 19 Nuff Said :-D
-
Are wormholes uni-directional?The X-Files has soooo much to answer for :)
-
Are wormholes uni-directional?So what is the definition of "The reports appear to be a hoax" 1) Andrew Carlssin , never existed ALL reports appear to be a hoax 2) Andrew Carlssin is a real person, but never but money on the stock market 3) Andrew Carlssin is a real person and made some money on the stock market 4) Andrew Carlssin is a real person and made a huge amount of money by insider trading 5) Andrew Carlssin is a real person, a time traveller , made a huge amount of money using knowledge of past events and the authorities are desperatley trying to cover up the truth. Quick Straw poll please :) Dave
-
Are wormholes uni-directional?or not ;P http://sec.broaddaylight.com/sec/FAQ_19_16002.shtm[^] Dave
-
Completion Ports and ODBCNorm Almond wrote: Simple multithreading suits your application which uses SQLExec, IOCP is for overlapped reads/writes with SQL does not support. As you state that SQL does not support overlapped read/writes, presumabley this means that IIS etc, are not truly scallable if the script uses database access X| . Thats a real bummer in the real world, though as i will have to have multi threads 'hanging around' for the database to return results. BTW thanks for your IOCP code. Dave
-
Completion Ports and ODBCIm dipping my toe into the murky waters of i/o completion ports.:confused: My app presently use threads to handle client connections , on for each connection. Naturally i now want to use i/o completion ports. Internally i do a lot of database access using odbc. Is there any way to link a SQLExec statement to a completion port ? Theres lots of examples of using sockets but nothing about databases. Doing an async read still involves polling to test the status of the executing statement, which will still mean using multiple threads. I cant believe theres not support for this but ,as ever, the MS docs are very light on the subject. Dave
-
Worst CodingMay I be so bold to suggest a new competition, sorry no prizes here, just satisfaction that you are a good programmer. How about a worst code comp. Heres my entry , found inside Crystal Reports as Page supression, i think you will all get the jist :) -------------------------------------------------------------- if {crNettCrystal.PaxCount} > 36 and pagenumber > 2 then false else if {crNettCrystal.CanxPublishedFareCount} + {crNettCrystal.CanxNettFareCount} + {crNettCrystal.CharterCount} > 2 and pagenumber = 3 then false else if {@SchedCount} = 0 and {@ChartCount} > 2 and pagenumber = 3 then false else // stu if {@SegCount} < 5 and {crNettCrystal.CanxPropCount} + {crNettCrystal.CanxCarHireCount} + {crNettCrystal.CanxSightSeeingCount} + {crNettCrystal.CanxTourCount} < 3 and {@Accom} + {@CarCount} + {@SightSeeCount} + {@TourCount} + {crNettCrystal.GroundAmendmentCount} < 3 and pagenumber = 3 then true else if {@SegCount} = 4 and {crNettCrystal.GroundAmendmentCount} > 0 and pagenumber =3 then false else if {@SegCount} = 4 and {crNettCrystal.FlightAmendmentCount} = 2 and {@SchedFlightCancCount} = 2 and pagenumber =3 then false else if {@SegCount} = 5 and {crNettCrystal.FlightAmendmentCount} = 2 and pagenumber =3 then false else if {@SegCount} > 5 and {@Accom} + {@CarCount} + {@SightSeeCount} + {@TourCount} > 3 and pagenumber = 4 then false else if {@SegCount} < 5 and {@Accom} + {@CarCount} + {@SightSeeCount} + {@TourCount} > 3 and pagenumber = 3 then false else if {@SegCount} < 5 and {@Accom} + {@CarCount} + {@SightSeeCount} + {@TourCount} > 3 and pagenumber = 4 then false else if {@SegCount} = 3 and {crNettCrystal.CanxNettFareCount} + {crNettCrystal.CanxPublishedFareCount} > 0 and pagenumber = 3 then false else if {@SegCount} = 2 and {crNettCrystal.CanxNettFareCount} + {crNettCrystal.CanxPublishedFareCount} > 0 and pagenumber = 3 then false //else if {@SchedCount} = 0 and {@ChartCount} < 5 and {@Accom} + {@CarCount} < 3 and {@InsCount} >0 and pagenumber = 3 then false else if {@SchedCount} = 0 and {@ChartCount} = 0 and {@Accom} + {@CarCount} < 3 and {crNettCrystal.CanxCarHireCount} > 0 and pagenumber = 3 then false else if {@SegCount} = 5 and {@ChartCount} =0 and {@Accom} + {@CarCount} < 3 and pagenumber > 2 then true // stu else if {@SchedCount} = 0 and {@ChartCount} < 5 and {@Accom} + {@CarCount} < 3 and pagenumber > 2 then true else if {@SegCount} = 9 and {@Accom} =4 and pagenumber = 4 then false else if {@SegCount} = 5 and {@Accom} + {@CarCount} =5 and {@InsCount}
-
Resource LimitI am about to embark on a larger project and need to know , is there any pratical limits as to the amount of resources, memory limit or quantity, within an MFC project ?.