Viewing 15 posts - 3,991 through 4,005 (of 5,588 total)
-- See how this starts off with a table and data in it?
-- If you had provided us the data in this format,
-- it would have made things easier...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 10:45 am
Good article Jason! 😉
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 14, 2010 at 8:08 am
Unless all the tables have the same structure, you'll probably be better off doing this dynamically. SSIS loads the column mappings for the export, and if they're changing, it will...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 10, 2010 at 11:30 am
What was only mentioned in passing was the performance mess that this would cause. The reason for this is that each stored procedure creates an execution plan based on what...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 10, 2010 at 8:09 am
This solution requires the DelimitedSplit function:
CREATE FUNCTION [dbo].[DelimitedSplit] (
@list varchar(max),
@Delimiter char(1)
)
RETURNS TABLE
AS
RETURN
-- first, need to break down into separate items. See Jeff Moden's article: -- The...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 10, 2010 at 5:31 am
CirquedeSQLeil (6/9/2010)
Declare @CounterTable Table (Table_Name Varchar(50), NumOccurrences int)
Insert into @CounterTable (Table_Name, NumOccurrences)
SELECT Table_Name
,COUNT(Table_Name) AS NumOccurrences
FROM INFORMATION_SCHEMA.Columns
GROUP BY Table_Name
HAVING ( COUNT(Table_Name) >= 0 )
Select Count(Table_Name) as...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 9:22 pm
Here's a set-based method that can be adapted into a table-valued function (Lowell's solution utilizes a scalar function). A TVF can be utilized with CROSS APPLY to get pretty dramatic...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 11:51 am
CirquedeSQLeil (6/9/2010)
Is it worthwhile to increase your personal knowledge (a common side effect of helping others)
This is the reason I do it... not only do I learn (from researching...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 11:01 am
I'm not sure what you're after:
1. Are you running the procedure from SSMS, and you want to put the results into a text file with this delimiter?
2. Or do you...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 10:54 am
Dan.Humphries (6/9/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 9:56 am
nfs_john (6/9/2010)
I surely can script out my tables etc. I figured you geniuses wouldn't need anything more than to see it to know where I am wrong.:-)
I think you're the...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 9:23 am
The first thing I see that I'm confused by is that your query is actually doing a clustered index seek... with the DateAdd and DateDiff functions being used around the...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 8:01 am
Great. Glad that I could help you out.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 7:41 am
Please post the actual execution plan for this query.
See the link "Performance Problems" in my signature for how to do this.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 6:55 am
Does this work for you?
I'm not sure that I follow what it is you are attempting. Why not just insert all the data in one set?
;WITH CTE AS
(
Select ...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
June 9, 2010 at 6:43 am
Viewing 15 posts - 3,991 through 4,005 (of 5,588 total)