Viewing 15 posts - 3,976 through 3,990 (of 5,588 total)
lmu92 (6/15/2010)
There are some...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 15, 2010 at 5:18 pm
To answer the question asked, the DateDiff will be more efficient than the convert. You might want to check out the "Common Date/Time Routines" link in my signature.
However, neither...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 15, 2010 at 3:10 pm
1. Identify duplicates.
2. For each duplicate, identify which one should be kept.
3. For each other table, update the duplicates with the value being kept.
4. Delete the duplicates.
I'd suggest a backup...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 15, 2010 at 7:25 am
So, based on this, I've come up with:
-- set up and populate a "source" table
IF OBJECT_ID('tempdb..#OriginalData') IS NOT NULL DROP TABLE #OriginalData
CREATE TABLE #OriginalData (CustomerData XML)
insert into #OriginalData
values ('<customer...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 15, 2010 at 7:20 am
Two things frustrate me about SSMS:
1. Intellisense gets in the way to the point I've got it turned off.
2. When working with a dual-monitor system, with SSMS on the secondary...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 2:50 pm
Fellow Threadizens... any help here would be grately appreciated! I'd really like to know what went wrong, and what to check to ensure that it doesn't happen again!
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 2:28 pm
Steve,
Thanks for the comparison.
Note that I include the in-line tally table so that it will run for folks without a real one. If you have a permanent one, yank out...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 2:11 pm
GilaMonster (6/14/2010)
Temp tables are specific to a connection. One session cannot affect a local temp table created by another session.
See my clarification in bold. Sessions CAN affect GLOBAL temp tables...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 2:02 pm
loki1049 (6/14/2010)
The whole process is a lot more complicated then I have explained. 3 mins seems quite reasonable for what it actually does in the end.
Does any of that code...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 2:00 pm
Once you create a temp table, it is available to any code further down that procedure, and to any procedures that the initial procedure may call after the table has...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 1:30 pm
Revenant (6/14/2010)
Sorry for the messy post -- I should have previewed it.
You can go back and edit it and make it, well, unmessy.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 1:21 pm
Miss.Delinda,
This does not update/insert the values into @SysRunno, but it does produce the results that you desire. You would need to dump this into a temp table and update/insert the...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 1:08 pm
A set-based approach (i.e. getting rid of those while loops) for doing this would be:
declare @Path1 varchar(100), @Path2 varchar(100), @PathLength int
select @Path1 = '\\server1\share1\apath1\abc',
...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 12:39 pm
Since you're on 2008, and dealing with file system paths, I'm wondering if you can do something with the new hierarchyid data type.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 11:48 am
Hmm, I just did something similiar.
The way I did this was to use the BULK INSERT command to put the file into a staging table. I then get the first...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 11:18 am
Viewing 15 posts - 3,976 through 3,990 (of 5,588 total)