Viewing 15 posts - 43,321 through 43,335 (of 59,098 total)
Heh... Ok... Remember... you asked.:-)
Here's why... the original code looks like this (for example)....
[font="Courier New"]--===== Create and populate the Tally table on the fly
SELECT TOP 1000000 --equates to more than 30 years of dates
IDENTITY(INT,1,1) AS N
INTO dbo.Tally
FROM Master.dbo.SysColumns sc1,
Master.dbo.SysColumns sc2
--===== Add a Primary Key to maximize performance
ALTER TABLE dbo.Tally
ADD CONSTRAINT PK_Tally_N
PRIMARY KEY CLUSTERED (N) WITH FILLFACTOR = 100
--===== Allow the general public to use it
GRANT SELECT ON dbo.Tally TO PUBLIC[/font]
If I throw that code into a code window in the presence of IE,...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 11:13 pm
smsam1 (6/20/2009)
i want to store only T or F in the flag field . for example if i enter 't' it should be stored as 'T' and vice versa.
Why? ...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 10:41 pm
haroonrashed786 (6/20/2009)
but..i have to use CLR triggers only
As previous suggested, you really need to tell us why you are constrained to using only CLR triggers. Even CLR experts like...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 10:39 pm
akash.suryan (6/18/2009)
Thanks Grant.....I will love to see those questions please let me know.....
You missed the point. After the first two or three questions, the questions are mostly not planned....
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 10:33 pm
It's probably not the answer you want to hear but, there's a large amount of functionality in many stored procedures that simply cannot be migrated to a function. Just...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 10:13 pm
Heh... like everything else, "It Depends". 😛 I'll do it 3 different ways depending on the situation and the database... use the Wizard to setup a plan, use the...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 10:05 pm
ktlady (6/20/2009)
Jeff, thanks for the pointer. Sorry that I missed it the first time. It sure is a great article! There is so much to learn for SQL server!
It's ok......
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 9:53 pm
As a side bar, for those interested in a Tally table solution that will work in virtually any release of SQL Server...
[font="Courier New"]--===== Build the test table as the data source
CREATE TABLE dbo.TableA (Column1 VARCHAR(5), Column2 VARCHAR(30))
INSERT INTO dbo.TableA
(Column1, Column2)
SELECT 'a1', '1:3:5:6' UNION ALL
SELECT 'a2', '2:4:5'
--===== Solution for virtually any version of SQL Server
INSERT INTO dbo.TableB
(Column1, Column2)
SELECT a.Column1,
SUBSTRING(a.Column2, t.N+1, CHARINDEX(':', a.Column2, N+1) - N-1) AS Column2
FROM dbo.Tally t
CROSS JOIN
(SELECT Column1, ':'+Column2+':' AS Column2 FROM dbo.TableA) a
WHERE N < LEN(a.Column2)
AND SUBSTRING(a.Column2, N, 1) = ':'
[/font]
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 9:41 pm
Florian Reischl (6/20/2009)
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 9:18 pm
Nice article and great explanation in the article... too bad they didn't actually test it for performance... 😉 Both of the following UDF's render identical execution plans and they...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 9:12 pm
balars_2000 (6/14/2009)
Thanks Jeff. Really appreciate your help mate.
Sorry for the late feedback on my part. Thank you for your's, Balars... it's the only "payment" we get for doing stuff...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 7:20 pm
Sorry for the delay. I agree that if you have any leading spaces, you'll need to do one of two things... so far as I'm concerned, the best thing...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 6:47 pm
Steve Jones - Editor (6/15/2009)
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 6:29 pm
jcrawf02 (6/18/2009)
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 6:25 pm
Joseph Henry (5/14/2009)
First and foremost, thank you very much for the help you have been providing me. It is helping me to both learn more and have a stronger...
--Jeff Moden
Change is inevitable... Change for the better is not.
June 20, 2009 at 6:17 pm
Viewing 15 posts - 43,321 through 43,335 (of 59,098 total)