Viewing 15 posts - 1,201 through 1,215 (of 2,171 total)
This is very simple error.
Just as the text suggests, you can't declare local ntext variables.
November 5, 2007 at 4:48 am
I don't get why recursive calls are so popular for factorial calculations...
CREATE FUNCTION dbo.fnFactorial
(
@n BIGINT
)
RETURNS BIGINT
AS
BEGIN
DECLARE @i BIGINT
IF @n >= 0 AND...
November 5, 2007 at 1:01 am
Sergiy (11/1/2007)
Does this script guarantee order of insertion?
Were the rows inserted into both tables in the same order?
Is the order displayed by following SELECTS...
November 1, 2007 at 2:47 pm
To add another twist.
I had an argument with Joe Celko about ORDER BY.
It seems that an ORDER BY operation needs [internally] a CURSOR.
October 26, 2007 at 12:26 am
Maybe it was this?
As I read somewhere once, you don't tell SQL how to do it, you tell SQL what you want, and that's a great way of thinking about...
October 25, 2007 at 9:05 am
DECLARE@Sample TABLE (UniqueID INT, NonUniqueID VARCHAR(10), aValue INT)
INSERT@Sample
SELECT1, 'A', 10 UNION ALL
SELECT2, 'A', 2 UNION ALL
SELECT3, 'A', 5 UNION ALL
SELECT4, 'B', 4 UNION ALL
SELECT5, 'B', 8...
October 25, 2007 at 4:51 am
Don't convert nor update!
Create a calculated column with the new datetimeformat...
October 25, 2007 at 3:36 am
-- Prepare sample data
DECLARE@Sample TABLE (Grp CHAR(1), dt DATETIME)
INSERT@Sample
(
Grp,
dt
)
SELECTTOP 100
CHAR(97 + ABS(CHECKSUM(NEWID())) % 26),
18000 + ABS(CHECKSUM(NEWID())) % 20000
FROMmaster..syscolumns AS sc1
CROSS JOINmaster..syscolumns AS sc2
-- Show the expected output
SELECTGrp,
RecID,
MAX(CASE WHEN hl =...
October 24, 2007 at 9:40 am
You are using SQL Server 2005, right?SELECTExempt_NonExempt,
Salary
FROM(
SELECTjt.Exempt_NonExempt
Salary,
ROW_NUMBER() OVER (PARTITION BY jt.Exempt_NonExempt ORDER BY Salary DESC) AS RecID
FROMEmployee AS e
INNER JOINJobTitle AS jt ON jt.JobID = e.JobID
) AS d
WHERERecID = 1
October 24, 2007 at 9:25 am
Have a look at this
October 24, 2007 at 9:17 am
Some of you know me by now.
I just couldn't resist this one!
Try this inline-function for speed, please...
CREATE FUNCTION [dbo].[fnAddWorkdays]
(
@StartDate DATETIME,
@DaysToAdd INT
)
RETURNS DATETIME
AS
BEGIN
RETURNCREATE FUNCTION [dbo].[fnAddWorkdays]
(
@StartDate DATETIME,
@DaysToAdd INT
)
RETURNS DATETIME
AS
BEGIN
RETURNDATEADD(DAY, CASE DATEDIFF(DAY, '17530101',...
October 24, 2007 at 5:59 am
Matt, excellent testing.
BUT... I am missing data from SQL Profiler regarding CPU/DURATION/READS and WRITES for the different methods used.
When I started out with SQL Server 2005 and PIVOT operator in...
October 24, 2007 at 12:12 am
DECLARE@Sample TABLE (ID INT, ParentID INT, Name VARCHAR(100), Amount MONEY)
INSERT@Sample
SELECT7, NULL, 'Ljunggren', 1000 UNION ALL
SELECT3, 1, 'Gulli', 200 UNION ALL
SELECT8, 7, 'Kerstin', 45 UNION ALL
SELECT1, NULL, 'Rosberg', 1 UNION ALL
SELECT4,...
October 23, 2007 at 9:06 am
Viewing 15 posts - 1,201 through 1,215 (of 2,171 total)