Viewing 15 posts - 271 through 285 (of 367 total)
This expression is independent of any language and datefirst settings:
-- gives 1 for monday..., 7 for sunday
datepart( weekday, @datetime + @@datefirst - 1 )
June 3, 2011 at 5:04 pm
Transaction log backup can be seen as equivalent of incremental backup, because to restore you need last full backup and all the increments (transaction log backups) until the point-in-time desired...
June 3, 2011 at 4:58 pm
The same problem I solved with a trigger. It works fast even with multi-row updates and inserts, because it checks overlapping only of id's that are "touched" (using INSERTED table...
June 3, 2011 at 4:45 pm
I also had the same problem in my everyday work, having 10 000+ procedures per database. You can imagine how log it takes to find the right one in the...
June 3, 2011 at 4:37 pm
As Paul said, check for indexes. Especially for two-column index on Table1( ClientID, Timestamp) or (Timestamp, ClientID) - test for both cases and measure logical reads. Experiment with cluster index...
June 3, 2011 at 4:26 pm
It's very difficult because there is almost no documentation on that. Documentation for MS Visual studio plugins has some mutual interfaces that can help. There are also some rare articles...
June 2, 2011 at 1:39 pm
You condense group of rows to one row. You can get max, min, avg, count(*) etc.
List of all aggregate functions is in t-sql reference:
http://msdn.microsoft.com/en-us/library/ms173454.aspx
You can use distinct only...
June 2, 2011 at 1:31 pm
Maybe this ?
SET NUMERIC_ROUNDABORT ON
June 2, 2011 at 10:08 am
INNER and OUTER keywords are optional, and personally, I ommit them in my code.
"JOIN" means "INNER JOIN". If there is LEFT, RIGHT or FULL keywords, it is outer join -...
June 2, 2011 at 10:06 am
I would move begin tran just after begin try, and commit tran just before end try.
That's because not all transactions can be commited.
If commit raises error and it is WITHIN...
June 2, 2011 at 10:02 am
select s.StudentID, s.Name, s.Section,
DifferentRecords =
CASE WHEN MAX(s.Percentage)<>MIN(s.Percentage)
OR MAX(s.SubjectID)<>MIN(s.SubjectID)
OR MAX(s.OtherActivities)<>MIN(s.OtherActivities)
THEN 'yes'
ELSE 'No'
END
from dbo.students s
group by s.StudentID, s.Name, s.Section
June 2, 2011 at 9:55 am
DECLARE @StartMonth DATETIME = '20100201'
SELECT NewMonth = DATEADD( month, cnt.number, @StartMonth )
FROM master.dbo.spt_values cnt
WHERE cnt.type='P' AND cnt.number <= 9
June 2, 2011 at 9:34 am
SQL Server does a very strange stuff with precision of the result when doing basic math operations (*, /). I did a research and to put it short, use DECIMAL(25,13)...
June 1, 2011 at 5:49 pm
You can declare a #temp table and insert id's there before the update/del,
or use this syntax for upd/del:
UPDATE a SET a.column1 = 'somevalue'
FROM table1 a
JOIN table2 b on a.id =...
June 1, 2011 at 5:39 pm
Is it coded in the driver or application, i don't know, but it is a very bad practice to "discover" parameters of a known stored procedure. (or it is a...
June 1, 2011 at 5:30 pm
Viewing 15 posts - 271 through 285 (of 367 total)