Interview Questions → SQL SERVER → SQL Server Questionnaire III

SQL Server Questionnaire III









  EXEC sp_renamedb 'oldName', 'newName'




  EXEC sp_rename 'oldName', 'newName'






















Select @@version








select datediff(dd,getdate(),getdate()+2)








select rand()










CREATE TABLE UniqueConstraintTable
(
	pk_id INT IDENTITY(1,1),
	other_id INT UNIQUE
)




CREATE PROC testuniqueness
AS
  BEGIN
  INSERT INTO UniqueConstraintTable VALUES(1)
  INSERT INTO UniqueConstraintTable VALUES(1)
  SELECT @@ERROR
END




EXEC testuniqueness






















create proc recursive_proc
@num int
as
print @num
if @num > 1
begin
	set @num = @num - 1
	exec recursive_proc @num
end






Posted By  -  Karan Gupta


Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250