Skip to content
Advertisement

Tag: sql-server

Dynamic order direction

I writing a SP that accepts as parameters column to sort and direction. I don’t want to use dynamic SQL. The problem is with setting the direction parameter. This is the partial code: Answer You could have two near-identical ORDER BY items, one ASC and one DESC, and extend your CASE statement to make one or other of them always

How to precompile stored procedures in SQL server?

Is there any way to pre compile stored procedures in SQL Server? My requirement goes like this.. I have some stored procedures, which take more time in compiling than executing. So I want to precompile all the stored procedures. It would be nice to precompile them when the db server is started and running. Any ideas on this would be

DCount vs. SQL SELECT COUNT(*)?

I am trying to get a count of all items sent to a supplier based on the purchase order they are assigned to. But I can’t seem to get the control to show a number of items based on the purchase order instance – it keeps throwing either a #name? or #error! message in the text box when the form

Copy Data from a table in one Database to another separate database

Basically I have a two databases on SQL Server 2005. I want to take the table data from one database and copy it to another database’s table. I tried this: This didn’t work. I don’t want to use a restore to avoid data loss… Any ideas? Answer SELECT … INTO creates a new table. You’ll need to use INSERT. Also,

Advertisement