which query u can write to sql server doesn't work
inbetween 7.00PM to nextday 9.00AM

Answers were Sorted based on User's Feedback



which query u can write to sql server doesn't work inbetween 7.00PM to nextday 9.00AM..

Answer / sarvesh

CREATE PROCEDURE usp_StartStop_services

AS
Begin
Declare @date as varchar(100)
SET @date = convert(varchar, getdate(), 114)
Print @date

if @date >= '19:00:00.000'
exec MASTER.DBO.xp_cmdshell 'NET Stop SQLSERVER'
Else if

@date >= '09:00:00.00' and @date < '19:00:00.000'

exec MASTER.DBO.xp_cmdshell 'NET START SQLSERVER'
END
GO

Is This Answer Correct ?    19 Yes 0 No

which query u can write to sql server doesn't work inbetween 7.00PM to nextday 9.00AM..

Answer / sumesh

Declare @hour varchar(100)
set @time=convert(varchar,getdate(),114)
set @hour=SUBSTRING(@time,1,2)
if(convert(int,@hour)>8 and convert(int,@hour)<19)
begin
print @time
print @hour
end

Is This Answer Correct ?    11 Yes 3 No

which query u can write to sql server doesn't work inbetween 7.00PM to nextday 9.00AM..

Answer / muhammadrashidmughal

select * from urTable
Where urDateColumn
Between '2007-10-20 17:00:00 PM'
and '2007-10-21 09:00:00 AM'

Is This Answer Correct ?    14 Yes 17 No

which query u can write to sql server doesn't work inbetween 7.00PM to nextday 9.00AM..

Answer / vimala

Declare @hour varchar(100)
set @time=convert(varchar,getdate(),114)
set @hour=SUBSTRING(@time,1,2)
if(convert(int,@hour)>8 and convert(int,@hour)<19)
begin
print @time
print @hour
end

Is This Answer Correct ?    2 Yes 5 No

which query u can write to sql server doesn't work inbetween 7.00PM to nextday 9.00AM..

Answer / sandeep rana

select * from table where columndata not in(select
columndata from table where date between '' and '')

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More SQL Server Interview Questions

What are different types of table joins?

0 Answers  


Other than truncate statement, which other command can by-pass the trigger on the tables?

0 Answers  


Explain relational data?

0 Answers  


What is sql service broker?

0 Answers  


How to find the date and time of last updated table?

3 Answers  






Describe how to use linked server?

0 Answers  


What are key constraints?

0 Answers  


Can an automatic recovery be initiated by a user?

0 Answers  


Which one is faster delete/truncate? Why?

1 Answers   Infosys,


How do I find the size of a sql server database?

0 Answers  


Explain Capacity planning to create a database? and how to monitor it?

0 Answers  


difference between Clustered index and non clustered index ?

0 Answers   Infosys,


Categories