Wednesday, October 15, 2014

How to check temp table exist in MS SQL Server?

IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL
    DROP TABLE #TempTavle

How to write error information into MS SQL Server log?

DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end

How to check exists file in MS SQL server

DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\FileName.csv',
@isExists OUTPUT
IF @isExists <> 1
begin
RAISERROR ('Can not find csv file', -- Message text.
16, -- Severity.
1 -- State.
) WITH LOG;
end

101 Great Answers to the Toughest Interview Questions: Fourth Edition

http://allanjwilson.weebly.com/uploads/1/3/4/0/13401940/101_great_answers_to_the_toughest_interview_questions.pdf