Viewing 15 posts - 1,711 through 1,725 (of 1,923 total)
Hmm, that would involve a minor tweak in the CTE , andrew... here is the tweaked code..
;WITH CTE(Birthdate,ROWID, DATE_COUNT)
AS
(
SELECT Birthdate, MAX(ROWID) , COUNT(Birthdate) FROM [dbo].[Birthdate] GROUP BY Birthdate
)
SELECT
...
April 22, 2010 at 6:58 am
This might be helpful for some who accidentally tumbles upon this thread 😀
IF OBJECT_ID('TEMPDB..#CONCAT_COLUMN_VALUES') IS NOT NULL
DROP TABLE #CONCAT_COLUMN_VALUES
CREATE TABLE #CONCAT_COLUMN_VALUES
(
GROUP_ID INT,
COL_VAL VARCHAR(5)
)
INSERT INTO #CONCAT_COLUMN_VALUES
SELECT...
April 22, 2010 at 6:48 am
Andrew, how about this following piece of code??
;WITH CTE(Birthdate, DATE_COUNT)
AS
(
SELECT Birthdate, COUNT(Birthdate) FROM [dbo].[Birthdate] GROUP BY Birthdate
)
SELECT
BD.ROWID,BD.Birthdate, BD.FIRSTNAME, CTE.DATE_COUNT
FROM
[dbo].[Birthdate] BD
LEFT JOIN
...
April 22, 2010 at 6:35 am
Ronald beat me to it.. but there is a difference between my code and ronald's.. ron's uses cursors, mine doesnt.. and i have also CASE statements to bring out the...
April 22, 2010 at 5:42 am
trybbe, this below code might do the trick for you..
IF OBJECT_ID('TEMPDB..#part') IS NOT NULL
drop table #part
...
April 22, 2010 at 5:33 am
The problem is here buddy
Trybbe (4/22/2010)
alter table tmp_Customers add (@Column_Name @Data_Type)
You cant pass a local variable to DDL statments.. now what u have resorted to using this...
April 22, 2010 at 5:13 am
One of the local variable is initiated to NUL, buddy... Check up all of your local variables for null and then include them in your dynamice sql..
April 21, 2010 at 11:15 pm
Lynn Pettis (4/21/2010)
Please note that if you write the query the way Coldcoffee showed you it will not take advantage of any indexes that may exist on your table.
Guess am...
April 21, 2010 at 8:24 pm
sharonrao123 (4/21/2010)
Cold coffee made me coolllll 😀
:blush: Thanks, Shilpa!!! Glad that the code helped and happy that your issue is resolved 😉
April 21, 2010 at 8:08 pm
Buddy, as Lynn said, it really is hard to guess and tell u a solution.. so post ur sample records, ur table structure and desired output..
But for starters, i will...
April 21, 2010 at 10:29 am
sharonrao123 (4/20/2010)
My brian is all hot I am craving for some cold coffee now.
You wanted a cold-coffee, and here is your coldcoffee presenting you with a cold code :-D!! check...
April 21, 2010 at 6:40 am
Hey there, can you give us the complete command u are trying to execute?
April 21, 2010 at 5:53 am
Paul White NZ (4/20/2010)
I am considering a Part III, to cover some specific cases where APPLY can produce solutions which are more efficient than any other method...we'll see.Paul
Wow, thats a...
April 21, 2010 at 5:49 am
Wonderful article WayneS.. a great read.. taught me new things about Ranking... Thanks 🙂
April 21, 2010 at 5:46 am
Viewing 15 posts - 1,711 through 1,725 (of 1,923 total)