|
Re: SQL SUM
12/04/2010 11:08:26 AM
(Total replies: 0)
|
| SELECT <columns>,SUM(COALESCE([col1],0)+COALESCE([col2],0)+COALESCE([col2],0)+COALESCE([col3],0))
OVER (PARTITION BY userid) AS Total
FROM yourtbl
|
|
|
|
Re: SQL SUM
12/04/2010 11:08:28 AM
(Total replies: 0)
|
| SELECT <columns>,SUM(COALESCE([col1],0)+COALESCE([col2],0)+COALESCE([col2],0)+COALESCE([col3],0))
OVER (PARTITION BY userid) AS Total
FROM yourtbl
|
|
|
|
Re: SQL SUM
12/04/2010 11:08:29 AM
(Total replies: 0)
|
| SELECT <columns>,SUM(COALESCE([col1],0)+COALESCE([col2],0)+COALESCE([col2],0)+COALESCE([col3],0))
OVER (PARTITION BY userid) AS Total
FROM yourtbl
|
|
|
|
Re: Loop vs. UNION Performance
9/11/2009 6:18:18 AM
(Total replies: 0)
|
| Hi
Can you post sample data + an expected result to be tested? Aslo ,what version of SQL Server are you using?
|
|
|
|
|
|
|
Re: How to Update Statistics On Tables, which needs to be updated.
6/07/2009 2:54:17 PM
(Total replies: 0)
|
| SELECT
object_name(si.[object_id]) AS [TableName]
, CASE
WHEN si.[index_id] = 0 then 'Heap'
WHEN si.[index_id] = 1 then 'CL'
WHEN si.[index_id] BETWEEN 2 AND 250 THEN 'NC ' + RIGHT('00' + convert(varchar, si.[index_id]), 3)
ELSE ''
END AS [IndexType]
, si.[name] AS [IndexName]
, si.[index_id] AS [IndexID]
, CASE
WHEN si.[index_id] BETWEEN 1 AND 250 AND STATS_DATE (si.[object_id], si.[index_id]) < DATEADD(m, -1, getdate())
THEN '!! More than a ... |
|
|
|
|
|
|
Re: Converstion Issue from varchar to data int
26/04/2009 3:05:54 PM
(Total replies: 0)
|
| You will have to change the WHERE condition to
SELECT [test ID]) FROM Data42 where [test ID] = '36' as SQL Server converts it to the datatype with highest precedens
http://blogs.msdn.com/craigfr/archive/2008/04/28/conversion-and-arithmetic-errors.aspx |
|
|
|
Re: Trigger VS Stored Procedure
2/04/2009 10:19:18 PM
(Total replies: 0)
|
| Hi dqw
First of all I think you do not handle multi insert/update/delete withing a trigger, you can easily fix that. Something like that
create trigger tru_MyTable on MyTable after update
as
if @@ROWCOUNT = 0
return
insert MyAuditTable
select i.ID, d.MyColumn, i.MyColumn from inserted i
join deleted d on d.ID = o.Id
go
Regarding your question, you will have to grant ALTER permission on the table on which the trigger is defined.
Also to disable ... |
|
|
|
Re: how data/log files grow in 2000/2005
6/12/2007 7:40:34 PM
(Total replies: 1)
|
| Hi
What is the purpose to turn it off? Why not just set rup it to grow in MB instead of percentage?
I have not tried your scenario, so it seems that it will grow up to specified size, however, do some testing and you'll see. |
|