Viewing 15 posts - 1,021 through 1,035 (of 1,923 total)
Wow, thanks for the feedback Lucas.. Hope u understood what the code does 🙂
January 24, 2011 at 8:37 am
mister.magoo (1/24/2011)
Dave Ballantyne (1/24/2011)
WHILE @@ROWCOUNT=3
So , you are...
January 24, 2011 at 5:35 am
Dave Ballantyne (1/24/2011)
WHILE @@ROWCOUNT=3
So , you are inserting...
January 24, 2011 at 5:22 am
Dave Ballantyne (1/24/2011)
WHILE @@ROWCOUNT=3
Even i have a doubt in the code , Magoo... Do we really need UNPIVOT ? i guess, your code will work even without the...
January 24, 2011 at 5:19 am
How about this:
;WITH RANDOMIZER AS
(
SELECT GroupedCol, MIN(ABS(CHECKSUM(NEWID()))) NWID
FROM #TESTSORTING
GROUP BY GroupedCol
)
SELECT TS.*
FROM #TESTSORTING TS
INNER JOIN RANDOMIZER RND
...
January 24, 2011 at 5:10 am
2 options that i could think of:
Option 1 : By using multiple statement , one for INSERT of new records and UPDATE for old records
Option 2 : Put data from...
January 24, 2011 at 4:43 am
As u have posted it in 2008 forums, i assume u have SQL 2008 in your machine. This following code will do what u wanted (uses MERGE statement)
--BEGIN TRAN
MERGE Emp_dest...
January 24, 2011 at 3:42 am
when u dont have a WHERE clause or JOIN clause , u never are going to use to a INDEX, so ur time taken is quite normal..
January 23, 2011 at 12:28 am
Modified version (assumes ID column is already present in the table)
DECLARE @BITBUCKET INT
SET NOCOUNT ON
SET STATISTICS TIME ON
;WITH Unpivoted_List AS
(
SELECT ROW_NUM , ValInCol
FROM
( SELECT ID AS ROW_NUM ,idMvt1,idMvt2,idMvt3 ...
January 22, 2011 at 8:36 pm
@jeff, u are absolutely right.. i mis-read the requirement; from morning (its morning in INDIA now, as i write) i was thinking about that only.. So i sat and put...
January 22, 2011 at 8:12 pm
Ok, i had some time to peek into this. Here are the results:
Test Data:
USE TempDB
GO
SET NOCOUNT ON
IF OBJECT_ID(N'MVTS',N'U') IS NOT NULL
DROP TABLE MVTS
CREATE TABLE MVTS ( ...
January 22, 2011 at 7:44 am
Sorry for leading you into a wrong path, i figured out a simple UNPIVOT could do what we need. From the requirement, i am guessing that you need to find...
January 22, 2011 at 7:26 am
Probably a self-referencing CTE should do it! Have u tried that?
January 20, 2011 at 11:32 pm
Hey Jeff, thanks for article.. well written and full of information! Thanks a bunch! 🙂
January 20, 2011 at 11:26 pm
But in any case, David's code will beat mine pants down..
January 20, 2011 at 9:37 pm
Viewing 15 posts - 1,021 through 1,035 (of 1,923 total)