Viewing 15 posts - 2,221 through 2,235 (of 3,957 total)
Jason-299789 (1/8/2013)
Dwain, I figured out why yours didnt work you're addind on the Julian day which is 1-365/366
I think you need to add the Week day number...
January 8, 2013 at 1:56 am
Or, even simpler:
WITH Filenames (fn) AS (
SELECT 'XX_YYYYY_AA_BBB_SampleTransaction_120807_55322.TXT'
UNION ALL SELECT 'XX_YYYYYY_DDD_MasterTransaction_120807_00005.TXT')
SELECT fn=LEFT(fn, PATINDEX('%[0-9]%', fn)-2)
FROM Filenames;
January 8, 2013 at 1:38 am
sqlstud (1/8/2013)
dwain.c (1/8/2013)
WITH Filenames (fn) AS (
SELECT 'XX_YYYYY_AA_BBB_SampleTransaction_120807_55322.TXT'
UNION ALL SELECT 'XX_YYYYYY_DDD_MasterTransaction_120807_00005.TXT')
SELECT fn=SUBSTRING(fn, 1, CHARINDEX('.', fn))
FROM Filenames;
WITH Filenames (fn) AS (
SELECT 'XX_YYYYY_AA_BBB_SampleTransaction_120807_55322.TXT'
UNION ALL SELECT 'XX_YYYYYY_DDD_MasterTransaction_120807_00005.TXT')
SELECT fn=Item
FROM Filenames
CROSS APPLY...
January 8, 2013 at 1:32 am
alex 64682 (1/7/2013)
January 8, 2013 at 1:26 am
CELKO (1/7/2013)
January 8, 2013 at 1:15 am
Jason-299789 (1/8/2013)
Coming from a DW background the persisted calendar table is second nature, and I'm surprised more traditional OLTP systems dont implement...
January 8, 2013 at 12:54 am
Here are two ways:
WITH Filenames (fn) AS (
SELECT 'XX_YYYYY_AA_BBB_SampleTransaction_120807_55322.TXT'
UNION ALL SELECT 'XX_YYYYYY_DDD_MasterTransaction_120807_00005.TXT')
SELECT fn=SUBSTRING(fn, 1, CHARINDEX('.', fn))
FROM Filenames;
WITH Filenames (fn) AS (
SELECT 'XX_YYYYY_AA_BBB_SampleTransaction_120807_55322.TXT'
UNION ALL SELECT 'XX_YYYYYY_DDD_MasterTransaction_120807_00005.TXT')
SELECT fn=Item
FROM Filenames
CROSS APPLY PatternSplitCM(fn, '[0-9a-zA-Z_]')
WHERE...
January 8, 2013 at 12:48 am
Jason-299789 (1/8/2013)
January 8, 2013 at 12:22 am
Why not use:
TRUNCATE TABLE tblIDNames
Instead of:
DELETE FROM tblIDNames
January 7, 2013 at 10:51 pm
aerojockey (1/7/2013)
January 7, 2013 at 10:48 pm
If you don't want to create a calendar table, you can do this (which really just creates the calendar table on the fly).
CREATE TABLE #Contracts
(
ContractNumber INT
,ContractStartDate DATETIME
,ContractEndDate DATETIME
,ContractAmount MONEY
);
INSERT INTO...
January 7, 2013 at 6:15 pm
ericwood8 (1/7/2013)
On Sign Reversals section, imagine that entry 7 & 8 were $500 instead of $400. :
UNION ALL SELECT 500, '+' --...
January 7, 2013 at 5:30 pm
bthomson (1/7/2013)
you used a custom table value function called DelimitedSplit8kprobably works like most splits but... just thought you should know.
Hi bthomson! Thanks for dropping by.
There is a link in...
January 7, 2013 at 5:23 pm
Here is the FUNCTION referenced in the article. Copy/paste this code into an SSMS window on your database and execute the script.
-- PatternSplitCM will split a string based on...
January 7, 2013 at 5:20 pm
Agreed that not sure why you wouldn't want to use a CTE, but here's another alternative.
DECLARE @H TABLE
(House_Acc INT, Accountid INT, repcode VARCHAR(10))
INSERT INTO @H
SELECT 123,...
January 7, 2013 at 2:20 am
Viewing 15 posts - 2,221 through 2,235 (of 3,957 total)