Viewing 15 posts - 931 through 945 (of 1,497 total)
I suspect using CASE would work better:
DECLARE @StartDate datetime
,@EndDate datetime
SELECT @StartDate = '20090920'
,@EndDate = '20090923'
SELECT [Terminal ID]
,COUNT([Terminal ID]) AS TotalTrans
,COUNT(CASE WHEN Reject = '' AND [Fee Amount] <> '0000000' AND...
September 29, 2009 at 3:49 am
In SQL2008 this blog from Hugo Kornelis suggests that using MERGE is the way to go:
http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx
If you have a lot of columns to compare then you can use INTERSECT as...
September 15, 2009 at 9:48 am
EXEC sp_executesql ...
Syntax is in BOL.
September 9, 2009 at 4:24 am
Brian Cromwell (9/3/2009)
September 3, 2009 at 11:15 am
Just use the REPLACE command as suggested above. Something like:
SELECT REPLACE(REPLACE(REPLACE(REPLACE(@SearchText, ' and ', '_AND_'), ' or ', '_OR_'), ' ', ' OR '), '_', ' ')
September 2, 2009 at 6:13 am
Calling a SP from within a trigger is usually a bad idea. It also suggests that you are using a cursor within the trigger - an even worse idea.
I suspect...
September 1, 2009 at 11:17 am
DECLARE @jdate int
SET @jdate = 109252
SELECT DATEADD(d, @jdate - 69189, 0)
August 28, 2009 at 6:45 am
UPDATE needs to know which columns it is updating so the only way with static SQL is:
UPDATE RB_Products
SET Sequence1 =
CASE @TypeId
WHEN 1 THEN @sequence
ELSE Sequence1
END
,Sequence2 =
CASE @TypeId
WHEN 2 THEN...
August 28, 2009 at 5:38 am
Even to SQL2008, SCOPE_IDENTITY() etc still have a parallelism bug.
August 25, 2009 at 10:01 am
I am not sure what you are attempting but
SELECT IDENT_CURRENT('table')
will return the last identity value generated for a given table.
If the last insert was rolled back, this will not be...
August 25, 2009 at 9:16 am
DECLARE @t TABLE (t bit)
DECLARE @r int
SET ROWCOUNT 100
INSERT INTO @t SELECT 1 FROM YourTable WHERE [name] LIKE 'a%'
SET @r = @@ROWCOUNT
SET ROWCOUNT 0
PRINT @r
August 24, 2009 at 8:34 am
NULLS still count in a COUNT
Umm... not according to my understanding.
DECLARE @t TABLE
(
Col int
)
INSERT INTO @t
SELECT NULL UNION ALL
SELECT 1 UNION ALL
SELECT NULL UNION ALL
SELECT NULL UNION ALL
SELECT NULL
SELECT COUNT(Col)
FROM...
August 18, 2009 at 5:25 am
Dave - why do you think that this will not work?
I think Dave is a bit cross-eyed this morning! 🙂
The OP is JOINing on ClientID but COUNTing BackupID. This could...
August 18, 2009 at 5:09 am
Logically the main clauses of a SELECT statement are evaluated in the following order:
FROM
WHERE
GROUP BY
HAVING
SELECT
DISTINCT
ORDER BY
ie WHERE is evaluated before Total is defined so the only way to use it...
August 18, 2009 at 3:42 am
river (8/14/2009)
I have other question related to the same problem.
I now can run the query, but in SQL Server 2000 this query executes in 2...
August 14, 2009 at 9:52 am
Viewing 15 posts - 931 through 945 (of 1,497 total)