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 :)
where datediff(dd,start_date,end_date)>0 can be converted to where end_date>start_date Isn't it? :)
Also is the format same for all set of data or different?
Untested declare @month varchar(20) set @month='June' 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 select @@version
Note that this is only availbe from version 2012 onwards
or 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? Update B set col2=1 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
One simple method is to use check constraint to disallow negatives int_col int check (int_col >=0)
Any of the columns referenced in where clause is indexed?
Separate names with a comma.