Viewing 15 posts - 436 through 450 (of 3,957 total)
Lowell (1/29/2015)
you can pass a table value parameter, which you have to define first, and then you can use it.
Just watch out for this weird bug:
http://www.sqlservercentral.com/Forums/Topic1653333-392-1.aspx#bm1653437
January 29, 2015 at 5:31 pm
Chiming in so I see sample data when it is posted because I'd like to take a crack at it too. Inventory problems can be lots of fun, particularly...
January 29, 2015 at 5:21 pm
Bhushan Kulkarni (1/28/2015)
Optimized one..
USE [AdventureWorks2008]
GO
SELECT P.*
FROM
Person.Person P
WHERE
P.BusinessEntityId & 1 = 0
Interesting but it is not guaranteed to return alternate rows if there are gaps in BusinessEntityID.
January 29, 2015 at 5:15 pm
Could this be a case of the Halloween problem?
Read: The Halloween Problem – Part 2 by Paul White (there are 4 parts linked in at the bottom).
Look for an "Eager...
January 29, 2015 at 5:07 pm
pharmkittie (1/29/2015)
January 29, 2015 at 4:55 pm
sonchoix (1/29/2015)
dwain.c (1/28/2015)
What happens when you have more than 6 policies in any of the categories?Thanks.
The number of output is fixed and won't change in the future.
Then you should probably...
January 29, 2015 at 4:51 pm
Maybe something like this?
SELECT *
FROM vm
WHERE vm.visit_date >= DATEADD(month, DATEDIFF(month, 0, DATEADD(month, -1, CURRENT_TIMESTAMP)), 0) AND
vm.visit_date < CURRENT_TIMESTAMP-1;
CURRENT_TIMESTAMP and GETDATE() are the T-SQL functions to get...
January 29, 2015 at 12:02 am
Personally I wouldn't go with a home-grown solution for this "packing intervals" problem.
Instead I'd seek out the literature and find that SQL MVP Itzik Ben-Gan has proposed a very fast...
January 28, 2015 at 6:28 pm
Such an odd requirement could only come as homework. What Gail has suggested will work.
Here is another way that gets you the matching words (MW) column only.
create table #test_table...
January 28, 2015 at 5:59 pm
Maybe something like this (using Jeff Moden's community string splitter DelimitedSplit8K)?
DECLARE @ListOfTables VARCHAR(8000) = 'Table1,Table2'
,@SQL NVARCHAR(MAX);
SELECT @sql=s
FROM
(
SELECT ';SELECT Err=CASE (SELECT COUNT(*)...
January 28, 2015 at 5:33 pm
What happens when you have more than 6 policies in any of the categories?
January 28, 2015 at 5:12 pm
Why not make c1 an identity column?
Otherwise you can use a Tally table. Search on "tally table" and you'll find plenty of ways to do that.
January 28, 2015 at 4:56 pm
David Burrows (1/28/2015)
ALTER TABLE DROP COLUMN ID
GO
ALTER TABLE ADD ID...
January 28, 2015 at 4:39 pm
Brandie Tarvin (1/27/2015)
WayneS (1/27/2015)
Brandie Tarvin (1/27/2015)
Excuse me while I stand over in my corner gloating that I figured something out all by my lonesome without looking anything up. YES!
Congrats Brandie....
January 27, 2015 at 4:56 pm
Stephanie Giovannini (1/27/2015)
January 27, 2015 at 4:44 pm
Viewing 15 posts - 436 through 450 (of 3,957 total)