IF (object_id ('tempdb.dbo.#fact_stg') is not null)
BEGIN
DROP TABLE #fact_stg
END
Again, me with the syntax ;-)
"Give someone a program, and frustrate them for a day; Teach someone to program, and frustrate them for a lifetime." - Unknown
IF (object_id ('tempdb.dbo.#fact_stg') is not null)
BEGIN
DROP TABLE #fact_stg
END
Again, me with the syntax ;-)
Many thanks to kselvia who posted this at: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=37760
I'm adding it here in case the forum I found this on loses the posting:
"
CREATE FUNCTION dbo.fCapFirst(@input NVARCHAR(4000)) RETURNS NVARCHAR(4000)
AS
BEGIN
DECLARE @position INT
WHILE IsNull(@position,Len(@input)) > 1
SELECT @input = Stuff(@input,IsNull(@position,1),1,upper(substring(@input,IsNull(@position,1),1))), @position = charindex(' ',@input,IsNull(@position,1)) + 1
RETURN (@input)
END
It's not as sophisticated as the others but it's about 3 times as fast:
select dbo.fCapFirst(Lower(Column)) From MyTable
"
. . . Totally awesome!
Select
RowNumber = row_number() over(order by MonthLabel),
MonthLabel
from (Select distinct MonthLabel, Year from dbo.dimTime) dt