Viewing 15 posts - 106 through 120 (of 238 total)
All the predefined error messages are stored in master.dbo.sysmessagess. You can get error code from @@ERROR, save it in a local variable, then select from that table where error =...
February 24, 2003 at 12:28 pm
It seems the best way would be to bring the data to the middle tier application, perform text manipulations there and put data back to SQL Server. While this is...
February 21, 2003 at 12:12 pm
IF you have to fit in one statement, here is how:
DECLARE @current bit
SET @current = 1 -- or 0
SELECT ... FROM current_table
WHERE @current = 1
UNION
SELECT ... FROM history_table
WHERE...
February 20, 2003 at 6:13 pm
IF you mean number of records, use
EXECCUTE sp_spaceused 'table_name'.
This is the fastest way but not always be exact (it reads the number from sysindexes). Otherwise use
SELECT COUNT(*) FROM...
February 20, 2003 at 6:04 pm
Would this answer your request?
DELETE tblMachineInfo
WHERE ID_Machine_Info IN
( SELECT TOP 5 ID_Machine_Info FROM tblMachineInfo ORDER BY ID_Machine_Info DESC )
February 20, 2003 at 4:37 pm
Showplans for these two queries would be different. Check those out and you will get the clue. I think Optimizer is smart enough to see that the second query could...
February 19, 2003 at 6:28 pm
This operation is called pivoting. It is not supported by the current version of SQL Server but you can do it with one SELECT statement, one table scan. Check this...
February 19, 2003 at 5:54 pm
Try something like this. It seems to be working but you need to test for performance if tables are large. The query is not very optimized (IN clause) but allows...
February 19, 2003 at 12:59 pm
Carl, I think you may want to start with running Windows Performance Monitor and recording counters related to SQL Server activities. You will find those there.
With the Profiler, try...
February 18, 2003 at 5:48 pm
notrib, your second query will always delete all rows from the table1 one if there is at least one record in table2. It is probably not what you need. Just...
February 18, 2003 at 5:41 pm
Of course, there is a tradeoff once you start using the Profiler: it records everything. However you can limit what you record by setting options of the trace. How to...
February 17, 2003 at 2:33 pm
select adviserId, MIN( SQRT( SQUARE( northing ) + SQUARE( easting ) ) )
FROM #adviser
GROUP BY adviserId
February 17, 2003 at 10:49 am
I think you can output the Profiler results to a file. Just look at the options in the dialog box.
February 14, 2003 at 10:24 am
Because of the IN clause, optimizer cannot use an index on the ID column. If the table is large, it will take awhile to loop through every number in your...
February 13, 2003 at 5:47 pm
No, you have to be an sa to run Trace (or Profiler) in the SQL Server 7 and 2000.
February 13, 2003 at 5:42 pm
Viewing 15 posts - 106 through 120 (of 238 total)