Viewing 15 posts - 43,216 through 43,230 (of 59,063 total)
Let's see if it actually made it from one server to another. What do you get when you run the following?
SELECT *
FROM sys.Objects
WHERE Name = 'fn_Split'
If the answer...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 25, 2009 at 3:01 pm
jo stovall (6/25/2009)
I need help using a User Defined Function within a query on a table.
The function performs correctly.
select * from...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 25, 2009 at 1:17 pm
Senthilnathan.Karunakaran (6/25/2009)
The plan was better with XML split than SQL function; however...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 25, 2009 at 12:37 pm
Sinshith S Anand (6/23/2009)
Please contribute ur ideas...I have got only one correct answer....
Heh... the correct answer is "Anything that doesn't resort to RBAR or hidden RBAR."
--Jeff Moden
Change is inevitable... Change for the better is not.
June 24, 2009 at 8:25 am
Eswin (6/23/2009)
CREATE UNIQUE CLUSTERED
...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 24, 2009 at 5:59 am
When you specify the PK for a table, unless you explicitly ask for a non-clustered PK, it will automatically create a clustered index on the PK.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 24, 2009 at 1:12 am
You've already written it. Look at the SELECT statement you built for the cursor. Just put the display in the text mode and let just that SELECT do...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 24, 2009 at 1:06 am
Of course, there's my favorite...
[font="Courier New"] SELECT t.N
FROM dbo.Tally t
WHERE t.N <= 100[/font]
You should Google the term "Tally Table" or click on the following link.
http://www.sqlservercentral.com/articles/T-SQL/62867/
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 11:50 pm
Of course, there's always the Itzik method...
[font="Courier New"] CREATE FUNCTION dbo.fnItzekNumsTest(@N AS BIGINT)
RETURNS TABLE
AS
RETURN
WITH
L0 AS (SELECT 1 AS C UNION ALL SELECT 1), --2 rows
L1 AS (SELECT 1 AS C FROM L0 AS A, L0 AS B),--4 rows
L2 AS (SELECT 1 AS C FROM L1 AS A, L1 AS B),--16 rows
L3 AS (SELECT 1 AS C FROM L2 AS A, L2 AS B),--256 rows
L4 AS (SELECT 1 AS C FROM L3 AS A, L3 AS B),--65536 rows
L5 AS (SELECT 1 AS C FROM L4 AS A, L4 AS B),--4294967296 rows
Nums AS (SELECT ROW_NUMBER() OVER (ORDER BY C) AS n FROM L5)
SELECT N FROM Nums WHERE n <= 100[/font]
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 11:43 pm
hi_abhay78 (6/23/2009)
WITH Numbers(Number) AS (
SELECT 1
UNION ALL
SELECT Number + 1
FROM Numbers
WHERE Number <= 99
)
SELECT *...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 11:36 pm
It sounds like you're using a cursor or while loop. What is it that you're doing that requires one?
As a side bar, you can get around the limitations of...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 11:12 pm
Will there ever be 3 rows?
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 8:38 pm
Steve Jones - Editor (6/23/2009)
I don't think anyone has crossed a line, but I see a few posts that are close. Please...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 7:48 pm
Paul White (6/23/2009)
Oh boy. So now "standard SQL" has been invoked.Jeff's gonna absolutely love this - I just hope Carl likes pork.
Heh... I never thought I'd tell someone to...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 7:45 pm
Charles Kincaid (6/22/2009)
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2009 at 7:39 pm
Viewing 15 posts - 43,216 through 43,230 (of 59,063 total)