Viewing 15 posts - 2,281 through 2,295 (of 2,458 total)
Cursors, loops and dSQL fall under the last choice column but this is one of those cases...
For tables you would do this:
EXEC sp_MSforeachtable'SELECT TOP 1 * FROM ?'
For...
March 7, 2013 at 3:23 pm
I know I am a little late here but, Great article Gus.
FYI - the to Celko's article (http://www.intelligententerprise.com/001020/celko.jhtml.) is broke 😉
March 6, 2013 at 3:59 pm
Lynn, Jeff, Kevin, ChrisM: thank you very much. This has been a particularly informative and excellent thread. It's given me a lot of new things to chew on.
Inline Table...
March 5, 2013 at 1:47 pm
This is something I need to play around with more. I took what Jeff said to imply that, in the code below, the iTVF function (nsq_iTVF) would be faster than...
March 1, 2013 at 1:46 pm
syedathariqbal (3/1/2013)
Managed to get the list using below query.
SELECT TABLE_NAME FROM [DB1].information_schema.TABLES
Where TABLE_TYPE='BASE TABLE'
EXCEPT
SELECT TABLE_NAME FROM [DB2].information_schema.TABLES
Where TABLE_TYPE='BASE TABLE'
In case there are other schemas:
SELECT TABLE_SCHEMA, TABLE_NAME...
March 1, 2013 at 11:46 am
No problem Amy.
That's actually a newer technique for me too and has been very helpful. You can do deletes in the same way...
;WITH X AS (SELECT * FROM dbo.emp...
February 28, 2013 at 8:21 am
Jeff Moden (2/25/2013)
Alan.B (2/25/2013)
If i am understand right. Function can return only one value. am i right?
Scalar functions return one value, table valued functions return a table variable.
Inline Table...
February 28, 2013 at 8:08 am
If i am understand right. Function can return only one value. am i right?
Scalar functions return one value, table valued functions return a table variable.
February 25, 2013 at 6:05 pm
Amy.G (2/25/2013)
...Now, I know if I just want a result set, I can use the query...
If you can produce the result set then all you can can produce an update...
February 25, 2013 at 4:49 pm
SQLWannabe (2/25/2013)
Thanks for the resposne. I should have been more clear. What I should've said was:
"I need to change the collation in my query".
The COLLATE function/keyword is definitely...
February 25, 2013 at 3:58 pm
SQLWannabe (2/25/2013)
Holy cr@p, that's exactly what I want.
I didn't even think about the collation.
So since my collation is: SQL_Latin1_General_CP1_CI_AS, I need to change the collation?
Can you give me...
February 25, 2013 at 12:06 pm
I started my technical career working on mainframes and switched to a database support role. Since then I have worked in the data world as a DBA, SQL Developer and...
February 13, 2013 at 4:48 pm
Using the sample code I created before you can also get days in/days not in using this:
DECLARE @startdate bigint=20121101,
@endDate bigint=20121130;
;WITH
notthere AS
(SELECTStudentID, COUNT(*) AS DaysAbs
FROM #x
WHERE DateID>=@startdate AND DateID<=@endDate
AND...
February 5, 2013 at 2:42 pm
This should do the trick:
-- Setup
IF OBJECT_ID('tempdb..#x') IS NOT NULL
DROP TABLE #x;
CREATE TABLE #x
( Studentid int, DateID bigint unique, attendaceind bit)
INSERT INTO #x
SELECT 1234, 20121031, 1 UNION ALL
SELECT...
February 5, 2013 at 2:29 pm
Viewing 15 posts - 2,281 through 2,295 (of 2,458 total)