tyagimanoj12 / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Elmah.SqlServer.sql should detect if the table already exists and return #256

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is a minor gripe which is why I put it in as an enhancement but it may be 
cleaner to detect if the ELMAH logging table already exists and exit gracefully 
if it does. Something like the following test as a statement before the CREATE 
TABLE statement.

IF EXISTS (SELECT * FROM sys.tables t JOIN sys.schemas s ON t.schema_id = 
s.schema_id WHERE t.name = 'ELMAH_Error' AND s.name = 'dbo')
BEGIN
  set noexec off

  PRINT 'The [dbo].[ELMAH_Error] table already exists. exiting script'

  set noexec on
END

Original issue reported on code.google.com by porter.n...@gmail.com on 13 Oct 2011 at 1:14