Viewing 15 posts - 1,651 through 1,665 (of 3,957 total)
Something like this should list out any of the products that fail your audit.
WITH ValidationTables (n, )
SELECT 1, [Key] FROM A
UNION ALL...
July 25, 2013 at 10:53 pm
Steven - Your posting gave me the idea for this (your Tally FUNCTION):
CREATE FUNCTION [dbo].[itvfTally]
(
@pMin BIGINT
,@pMax BIGINT
...
July 25, 2013 at 10:30 pm
Although the syntax is not the same, you could DECLARE a TYPE that is a TABLE and pass that into the FUNCTION.
You then just assign each value to a row...
July 25, 2013 at 8:32 pm
Here are some additional links:
Understanding and Using APPLY (Part 1)[/url] by Paul White
Understanding and Using APPLY (Part 2)[/url] by Paul White
The Cascading (CROSS) APPLY[/url] by Chris Morris
And don't miss the...
July 25, 2013 at 7:45 pm
Here's another way. Just uncomment your code and comment out the sample data.
WITH CTE (NMDOS, ETOTALDEB, tpdesc, dataobra, NOME, OBRANO, nmdoc, FNO, etiliquido)
AS (
--SELECT distinct BO.NMDOS,bo.ETOTALDEB, bo.tpdesc ,bo.dataobra,BO.NOME ,BO.OBRANO,ft.nmdoc,FT.FNO,CASE...
July 25, 2013 at 7:37 pm
Here's one way. Not sure it's the best way and it doesn't use OPENXML though:
DECLARE @Books XML = '
<bookstore>
<book>
...
July 25, 2013 at 6:54 pm
Jeff Moden (7/24/2013)
savycara (7/24/2013)
SELECT try_convert(date, substring(@d, 1, 4) +
CASE WHEN len(@d) = 5 THEN '0' ELSE '' END +
substring(@d, 5, 2) + '01')
This worked but...
July 24, 2013 at 9:46 pm
Why use a CASE at all?
WITH Rates (rate) AS (
SELECT -100 UNION ALL SELECT NULL UNION ALL SELECT 0
UNION ALL SELECT...
July 24, 2013 at 6:44 pm
Ignoring the try_convert (which is probably a good idea), I think this may be another way:
SELECT CONVERT(VARCHAR(10), CAST(STUFF('201311',5,0,'-0')+'-01' AS DATETIME), 101)
,CONVERT(VARCHAR(10), CAST(STUFF('20131',5,0,'-0')+'-01' AS DATETIME), 101);
July 24, 2013 at 3:10 am
HanShi (7/24/2013)
July 24, 2013 at 1:32 am
ColdCoffee (7/24/2013)
July 24, 2013 at 1:03 am
SELECT a.Col1, a.Col2, a.Col3, a.Col4
FROM #TableA a
LEFT JOIN #TableB b
ON a.Col1 = b.Col1 AND a.Col2 = b.Col2 AND
...
July 23, 2013 at 11:01 pm
Just for a little variety, I think this is another way:
SELECT a.ID, Cat -- , [Date], [Type]
,[FirstDate]=MIN([Date])
,[FirstType]=MAX(CASE WHEN a=[Date] THEN [Type] END)
...
July 23, 2013 at 7:31 pm
I guess that would depend on exactly what date you think 20114 represents.
SELECT '20114', CAST('20114'+0 AS DATETIME)
July 23, 2013 at 7:13 pm
I'd say that if you want this
SELECT DATEADD(week,DATEDIFF(week,7,GETDATE()),0)
To always return the Mon of the prior week, it works pretty well.
SET DATEFIRST 1
SELECT DATEADD(week,DATEDIFF(week,7,GETDATE()),0)
SET DATEFIRST 7
SELECT DATEADD(week,DATEDIFF(week,7,GETDATE()),0)
SELECT DATEADD(week,DATEDIFF(week,7,'2014-01-15'),0)
SELECT DATEADD(week,DATEDIFF(week,7,'2012-03-15'),0)
July 23, 2013 at 7:05 pm
Viewing 15 posts - 1,651 through 1,665 (of 3,957 total)