Viewing 15 posts - 796 through 810 (of 4,080 total)
If you may have a variable number of attachments, you can use CROSS APPLY with the .nodes method to break out multiple nodes into multiple rows. The...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 24, 2012 at 7:54 pm
p.s. I'm pretty sure that the presence of any NULL dates are going to throw a wrench into the gears.
Agreed. One fix would be to add COALESCE...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 8:44 pm
YSLGuru, this is the direct comparison code from Luis' time trial. Similar to the V2 logic and apparently more efficient, which you would expect because only...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 8:41 pm
I just saw your signature line, David. Are you quoting Heisenberg?
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 3:01 pm
Sorry... I overwrote my earlier comment that I know of no such native functionality.
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 2:57 pm
And V2 is even better
CREATE FUNCTION [dbo].[HiLoDate2]
(
@date1 datetime,
@date2 datetime,
@date3 datetime,
@date4 datetime
)
RETURNS TABLE
AS
RETURN
(
with cte (max1,max2, min1,min2 ) as
(select case when @date1 >= @date2 then @date1 else @date2...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 2:55 pm
Here you go.
------------------------------------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION dbo.HiLoDate
(
@date1 datetime,
@date2 datetime,
@date3 datetime,
@date4 datetime
)
RETURNS TABLE
AS
RETURN
(
with cte (xDate) as (
select @date1
union all
select @date2
union all
select @date3
union all
select @date4
)
select min(xDate) as LoDate,...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 2:25 pm
LEFT OUTER JOIN Information_Sales A ON Case IF EID = 0 or PID = 0 then SID = 148 ELSE UDF.NEW (EID,PID) = A.SID
Its important to remember that a CASE...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 1:53 pm
ib.naji (10/23/2012)
Luis Cazares (10/23/2012)
There's no need to create a view. You'll end up with millions of views that you won't use.+1
or even use a CTE.
+1 again for the CTE
with join_alias...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 23, 2012 at 12:43 pm
I am not saying this sarcastically, but honestly your best approach is to outsource this work to someone who knows what they are doing with respect to SQL and database...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 22, 2012 at 9:14 am
It might be easier for Jeff, or anyone else to give you a more detailed answer if you would illustrate what one or two of your reports look like. ...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 21, 2012 at 3:27 pm
A simple REPLACE() in your SELECT is all that is needed to substitute your parameter value for the constant text in your footer. In your example:
declare @test1...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 20, 2012 at 12:30 am
If I understand you, you want to have a default value to be returned whenever no value is specified.
Select order_nbr, field1, field2, field3
from table
where order_nbr = isnull(@Ord_nbr,'xxxxxx')
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 11, 2012 at 7:47 pm
Cauliflower is edible? Kul Wahad!
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 10, 2012 at 4:50 pm
You can direct the OUTPUT into a table or table variable for subsequent processing.
From BOL:
USE AdventureWorks2012;
GO
DECLARE @MyTableVar table(
EmpID int NOT NULL,
OldVacationHours int,
...
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
October 10, 2012 at 11:57 am
Viewing 15 posts - 796 through 810 (of 4,080 total)