Viewing 15 posts - 91 through 105 (of 422 total)
For versions SQL2008 or greater you can also do this:
;WITH cteSampleData1 (matchpattern,country,rate)
AS
(
SELECT 9526,'USA',0.80 UNION ALL
...
July 11, 2013 at 10:41 pm
Here's something I came up with. Not sure it's bullet-proof, but maybe it will give you
some ideas. Sorry that it's a bit of a kludge and not very elegant......
July 11, 2013 at 9:15 pm
OK, found another example.
SET NOCOUNT ON
DECLARE
@strSQL NVARCHAR(MAX)
SET @strSQL = '' -- required or the concatenation will return null
;WITH cteStore (SalesPersonID,TerritoryID) -- create some sample data
...
July 11, 2013 at 5:50 pm
It's a lot of work so I can't do it for you, but here's some basic examples:
[Repost from: http://www.sqlservercentral.com/Forums/FindPost1375776.aspx]
DECLARE
@x XML
,@s...
July 11, 2013 at 5:33 pm
brickpack (7/11/2013)
July 11, 2013 at 3:56 pm
Thanks Gail. I'll add my kudos too. One addition that would be very helpful would be examples for presenting executable sample data. Not only does that help the helpers, but...
July 11, 2013 at 3:13 pm
Try simplifying the query for testing just to see what you have in the Projects table without all of the other INNER JOINS. (I agree with Sean that the other...
July 10, 2013 at 7:58 pm
ShuaibV (7/10/2013)
July 10, 2013 at 7:32 pm
I use this syntax in my where clauses rather than case statements:
WHERE
((@StartDate IS NOT NULL AND StartDate >= @StartDate)
OR
(@StartDate IS NULL))
AND ((@EndDate...
July 10, 2013 at 3:38 pm
ShuaibV (7/10/2013)
Can someone please share if there are any functions or code to validate the Date in different format settings?
Ex:
----
If I enter the value "9999", the function should validate against...
July 10, 2013 at 3:28 pm
Here's a snippet of code that I think does what you want. You can define the schema variables using the SYSNAME datatype, but you will still have to use dynamic...
July 9, 2013 at 12:22 pm
See if this will help you. This reply was just posted yesterday so I'll just give the link:
July 9, 2013 at 10:56 am
Test results:
IDTitleMaxDateDuration
1Michael's Solution2013-07-071890
2Alan's Solution2013-07-072447
3Dwain's Solution2013-07-071280
4Steven's Solution12013-07-072154
5Steven's Solution22013-07-07710
6Steven's Solution32013-07-07473
7Steven's Solution42013-07-07490
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
SQL Server Execution Times:
CPU time = 0...
July 8, 2013 at 9:41 pm
More fun with stats, with timed durations thrown in...and 4 alternate solutions. All four of the new ones are a few milliseconds faster but the results vary from run to...
July 8, 2013 at 9:27 pm
Viewing 15 posts - 91 through 105 (of 422 total)