Viewing 15 posts - 13,051 through 13,065 (of 13,457 total)
you want to use the datediff function for this:
SELECT DATEDIFF(day, somedatecolumn, getdate()) AS no_of_days from sometable
SELECT * from sometable where DATEDIFF(day, somedatecolumn, getdate()) =3 --exactly 3 days old
SELECT * from...
May 17, 2006 at 9:05 pm
monster searches like this are bad, but sometimes you gotta do it:
I made an ugly server intensive cursor for a similar question a while back;noone came up with a...
May 17, 2006 at 11:38 am
you would not need to increase the size of the isql variable; that is just containing the command "sp_helptext your_long_procedure_name" ; i think the max size it could ever be...
May 16, 2006 at 7:35 am
ahh;
the subquery in the parenthesis needs an alias:
this fails: select name from (select name,id from sysobjects union select name,id from syscolumns)
this works:select name from (select name,id from sysobjects union...
May 15, 2006 at 12:43 pm
because of the sum function, you have to GROUP BY in the outer select: try this syntax:
select sum(col1),col2 from
(select col1,col2 from table1 union select col1,col2 from table2)
GROUP BY COL2
May 15, 2006 at 11:52 am
your syntax is incorrect:
AND (src_terrier.Areacode LIKE @chr_div+ '%')
so if @chr_div = 'EV', the addition of the % sign makes the wild card search anything that STARTS with 'EV', like 'evansville'...
May 13, 2006 at 6:44 am
if the IN statement was running accross a bigger list, like in(SELECT X FROM SOME TABLE),
I would expect it should be faster, because it would bailout as true on the...
May 12, 2006 at 11:10 am
i doubt it; most db servers are hidden behind the firewall at the hosting company, and only the web server can see the db server.
but that also means that you...
May 12, 2006 at 11:02 am
just missing the END command of the case statement: let me know how this seems to work now
(CASE WHEN @PropertyValue BETWEEN 1 AND 10
THEN @PropertyValue * 100000
WHEN @PropertyValue...
May 11, 2006 at 3:22 pm
there are quite a few on this site;
here is an example using this version of split:
http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=225
declare @string varchar(200),
@LeadTimeFrame int
set @LeadTimeFrame=3
if @LeadTimeFrame = 1 set @string='24'
else if @LeadTimeFrame =...
May 11, 2006 at 1:00 pm
MAYBE another indicator is this: the only difference i see forwhen
IF (@LeadTimeFrame = 1)
is evaluated, the SQL is the same except for an additional check in the WHERE...
May 11, 2006 at 11:53 am
i can see a minor improvement; it looks like that huge if-then-else to get the @PriceRange could be replaced by a three line case statement:
SET @PriceRange = (CASE...
May 11, 2006 at 11:23 am
there is a plug in for source safe on this site which keeps all the DDL in source sage for you; you could use that application as far as source...
May 11, 2006 at 9:01 am
here's another way to get them by using a cursor to enumerate the procs, and simply using sp_helptext:
declare
@isql varchar(2000),
@provname varchar(64)
declare c1 cursor for select name from sysobjects where name not...
May 11, 2006 at 7:48 am
the GUI doesn't let you browse to, or paste a UNC path; so to use the GUI, you MUST map a drive; if the problem was a scheduled job, then you...
May 11, 2006 at 7:32 am
Viewing 15 posts - 13,051 through 13,065 (of 13,457 total)