Interview Questions → SQL SERVER → SQL Server Questionnaire III
SQL Server Questionnaire III
EXEC sp_renamedb 'oldName', 'newName'
EXEC sp_rename 'oldName', 'newName'
select datediff(dd,getdate(),getdate()+2)
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
create proc recursive_proc
@num int
as
print @num
if @num > 1
begin
set @num = @num - 1
exec recursive_proc @num
end