Viewing 15 posts - 781 through 795 (of 1,246 total)
This sounds like one of those odd-nut problems that is most easily handled w/ a "quirky" update.
Before using this method in any kind of production code make sure you read...
December 15, 2016 at 2:14 pm
tacy.highland (12/2/2016)
REPLACE(RIGHT(CONVERT(CHAR(19),DATEADD(ss,@Time,0),100),7),' ','0')
and
CONVERT(varchar(20), CONVERT(time, DATEADD(SECOND, @time, CONVERT(datetime, CONVERT(date, getdate())))), 100)
...is that they appear to display the time as 07:30PM rather...
December 2, 2016 at 3:51 pm
Another option...
WITH
n (n) AS (SELECT 1 FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) n (n)),
cte_Tally (n) AS (
SELECT TOP 86399-- 86400 would be midnight of the following day...
ROW_NUMBER() OVER (ORDER BY (SELECT...
December 2, 2016 at 1:12 pm
Alan.B (11/28/2016)
Of that only works with the "numbers dash numbers dash letters" formatting.
Plus it boring... My "just for the fun of it" solution answered (what I thought) was a more...
November 28, 2016 at 2:38 pm
Alan.B (11/28/2016)
November 28, 2016 at 12:08 pm
Just for the fun of it...
Here's a function that'll remove all non-numeric values and place a single space between non-contiguous groups of numbers (not dependent on any specific pattern...
November 28, 2016 at 9:23 am
Here is another "Zero downtime" option that uses partition switching.
See the inline comments for the details...
USE tempdb;
GO
--=============================================================================
-- Create the "original" table and populate it
IF OBJECT_ID('dbo.OriginalTable', 'U') IS NOT NULL
DROP...
October 12, 2016 at 10:57 am
CELKO (10/10/2016)
I have a table of statuses(Open, Closed, etc.). I need to create a parameter that combines the first letter of multiple statuses, such as any status beginning with...
October 10, 2016 at 8:56 pm
Looks like a time code (fixed at 14 characters)... The following will work even if the file path changes...
DECLARE @input VARCHAR(1000) = '\\cc0dware01\BMF\RMS\REBATERATES-WORKING-2016ToEnd08-20160905180112.csv';
SELECT output = LEFT(RIGHT(@input, 18), 14);
October 10, 2016 at 5:05 pm
Sounds like a goofy assignment... There's no logical reason to use a CTE for this request... It just creates code clutter...
In any case it's simple enough to accomplish... but... like...
October 10, 2016 at 4:58 pm
eandre360 (10/9/2016)
Eirikur Eiriksson (10/9/2016)
Quick example, clean the string and stuff it with hyphens😎
Thanks Eirikur. Unfortunately, I won't be able to hardcode my. Need to figure out a way to either...
October 9, 2016 at 9:08 pm
Here's another option that actually updates the original table...
IF OBJECT_ID('tempdb..#TableName', 'U') IS NOT NULL
DROP TABLE #TableName;
CREATE TABLE #TableName (
Company INT NOT NULL,
OrderNum INT NOT NULL,
OrderLine INT,
Part CHAR(3) NOT NULL,
LineDesc...
October 6, 2016 at 9:33 am
Try it like this...
SELECT Id ,
XmlCol.query('./fullname').value('.', 'nvarchar(max)') AS 'fullname'
FROM @t t
...
October 6, 2016 at 8:22 am
There's probably a way to do this w/o taking 3 passes at the table but it's not jumping out at me at the moment...
In any case this should get you...
October 5, 2016 at 2:18 pm
Sorry... I missed the expected output...
A simple modification gets the desired results...
DECLARE
@BegDate DATE = '2016-01-05',
@EndDate DATE = '2016-06-22';
WITH
n (n) AS (SELECT 1 FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) n (n)),
cte_MonthStart...
October 5, 2016 at 10:52 am
Viewing 15 posts - 781 through 795 (of 1,246 total)