Viewing 15 posts - 3,361 through 3,375 (of 5,588 total)
You might want to check out the common date/time routines link in my signature.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 3, 2010 at 7:40 am
This should get you started.
Things still left to to:
1. convert to %, and summarize.
2. probably want this to be dynamic.
Please read the Cross-Tabs and Pivot Tables, Part 1 and Part...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 3, 2010 at 7:37 am
Trybbe (9/3/2010)
Thanks guys but what if I have two variables
Just call the DelimitedSplit8K function for each one.
However, I sense that there is something else going on. Do you need to...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 3, 2010 at 6:10 am
CirquedeSQLeil (9/2/2010)
WayneS (9/2/2010)
Click here for the latest Delimited Split Function.Then, it's just:
SELECT ITEMFROM dbo.DelimitedSplit8k(@val, ',')
Nice resource, Wayne.
Thanks. I've been using it so much lately, that I've made it...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 8:07 pm
anand_vanam (9/2/2010)
SET @FileName='SSC1, SSC2, SSC3'
CREATE TABLE #FileNames
(FileID INT IDENTITY(1,1),
FileNameList VARCHAR(30)
)
SET @FileName=LTRIM(RTRIM(@FileName))
--SELECT @FileName
BEGIN
...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 8:06 pm
declare @test-2 TABLE (customerID char(2), Cat varchar(5), Cnt int);
-- See how you start off by actually creating a table and then
-- inserting the data into it? Your doing this...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 8:01 pm
bpowers (9/2/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 7:50 pm
Glad you got it working... and I'm sorry that I had to disappear (time to drive home to avoid the hurricane).
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 7:45 pm
LutzM (9/2/2010)
WayneS (9/2/2010)
LutzM (9/2/2010)
But...DECIMAL(19,4) (or NUMERIC(19,4)) and MONEY are not, as I just googled...
It seems like SQL Server does the rounding different for money and numeric/decimal.
Good to know....
Probably has something...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 7:41 pm
And for what is perhaps the best explanation of the issues this causes, see Gail Shaw's blog[/url]
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 7:37 pm
Alvin Ramard (9/2/2010)
Steve Jones - Editor (9/2/2010)
Alvin Ramard (9/2/2010)
BTW, we need one more emoticon. We need one for banging head against something.Isn't that WayneS's avatar?
I wouldn't call it an...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 7:12 pm
LutzM (9/2/2010)
But...DECIMAL(19,4) (or NUMERIC(19,4)) and MONEY are not, as I just googled...
It seems like SQL Server does the rounding different for money and numeric/decimal.
Good to know....
Probably has something to do...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 1:22 pm
Looks like you just have to verify everything is fine, then you're ready to go!
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 1:16 pm
The table name can't be a variable in the CREATE TABLE statement, so you'll have to use dynamic sql:
DECLARE @sql varchar(max);
SET @sql = 'CREATE TABLE dbo.' + QuoteName(convert(char(10),'2010-09-02 14:56:09.840',101)) +...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 1:13 pm
Just to ensure there's no confusion, NUMERIC(19,4) and DECIMAL(19,4) are the same... or as BOL states it
numeric is functionally equivalent to decimal.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 2, 2010 at 1:02 pm
Viewing 15 posts - 3,361 through 3,375 (of 5,588 total)