What are the available indices?
Your WHERE condition should be
WHERE datecol>='2015-01-01' and datecol<'2015-03-31'
In Frank's code, Rooms R ON R.BuildingID = R.BuildingID should be Rooms R ON B.BuildingID = R.BuildingID
Another method (But may not be effecient)...
But you haven't specified start_date in your condition :)
can be converted to
Isn't it? :)
Also is the format same for all set of data or different?
declare @month varchar(20)
select dateadd(week,number,cast(@month+' '+datename(year,getdate()) as datetime)) from...
What are you doing with a cursor?
How about using app_name() to know the source and then drill down?
Looks like OP already found the solution
Are you running a procedure? Search for parameter sniffing
Also any size exceeding 8000 needs max type becuase you cannot have varchar(20000), varchar(374456), etc
Start with this
declare @t table(startdate datetime, end_date datetime)
insert into @t
select '2012-03-21 08:00:00.000','2012-03-21...
Are you sure? Run the following and see the version
Note that this is only availbe from version 2012 onwards
select * from test
where coalesce(col1,col2,col3,col4) is null or col1+col2+col3+col4=''
It is because a 32 bit SQL Server can only recognise a oracle client of 32 bit only
A reply to 9 year old thread :). I dont think a UDF is needed here. It is as simple as using a CASE expression
How are the tables related?
from tableb as b inner join tableA as a on B.col1=a.col1
Yes thats a good point Frank. SQL Server does not allow to have unsigned intergers as Mysql has
Separate names with a comma.