SQL Server interview questions & Answers Set 8

                                        

Is it possible to create tables in stored procedures using a variable for the table name?

create proc ShowMeHow
as

declare @Cities table( AirportCode char(3) not null primary key, CityName varchar(255) not null
)


insert into @Cities values('LAX', 'Los Angeles')
insert into @Cities values('ORD', 'Chicago')

select * from @Cities
go


How do I compare two values when one value(data type) is char and the other is an integer?

Use the “CONVERT” Function.

 

 

How to know Who Is Blocking Your SQL Server?

Simply execute the “sp_who” or “sp_who2” stored procedure. In sp_who result set observe the block column. In sp_who2 result set observe the block by column. In both result sets we got who Spid blocking the server.


0 Response to "SQL Server interview questions & Answers Set 8"

Post a Comment