Viewing 15 posts - 796 through 810 (of 4,081 total)
When considering datatypes, its important to remember that smaller is usually better. Using a numeric (2,0) datatype requires 5 bytes to store. Using an INT...
October 25, 2012 at 12:27 pm
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...
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...
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...
October 23, 2012 at 8:41 pm
I just saw your signature line, David. Are you quoting Heisenberg?
October 23, 2012 at 3:01 pm
Sorry... I overwrote my earlier comment that I know of no such native functionality.
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...
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,...
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...
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...
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...
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. ...
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...
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')
October 11, 2012 at 7:47 pm
Cauliflower is edible? Kul Wahad!
October 10, 2012 at 4:50 pm
Viewing 15 posts - 796 through 810 (of 4,081 total)