Hi

how can I test if a specific table on an SQL- Server (that I'm connected to) exists or not

Thank
Sam

Re: SqlConnection question by Mary

Mary
Sun Apr 18 10:52:00 CDT 2004

If you're already connected to a specific database you can use the
following query to determine if the table exists.

SELECT table_name FROM INFORMATION_SCHEMA.TABLES
WHERE table_type = 'BASE TABLE'

The other choice for table_type is 'VIEW'.

--Mary

On Sun, 18 Apr 2004 06:41:02 -0700, "Sam Johnson"
<anonymous@discussions.microsoft.com> wrote:

>Hi,
>
>how can I test if a specific table on an SQL- Server (that I'm connected to) exists or not?
>
>Thanks
>Sam


Re: SqlConnection question by Val

Val
Wed Apr 21 22:22:09 CDT 2004

Hi Sam,

You could query system tables. but if you want to be generic, then use
OpenSchema method if ADO or GetOledbSchemaTable method if ADO.NET

http://support.microsoft.com/default.aspx?scid=kb;en-us;309488

--
Val Mazur
Microsoft MVP


"Sam Johnson" <anonymous@discussions.microsoft.com> wrote in message
news:6E8AF8A0-6818-400D-AFAB-A1387201F54B@microsoft.com...
> Hi,
>
> how can I test if a specific table on an SQL- Server (that I'm connected
> to) exists or not?
>
> Thanks
> Sam