Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL-DMO questions

Author  Topic 

Wodzu
Yak Posting Veteran

58 Posts

Posted - 2007-10-02 : 09:26:50
Hi.

How can I check if the connection to the server was successful without raising an exception in the case were it was unsuccessful.

How can I check if the database which I want to create already exists on the server. Again, I want to do this silently.

Where I can find more info about SQL-DMO?

Thanks in advance.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-10-02 : 09:40:29
1. For checking whether connection to server is successful, you will have to handle the exception by writing exception handling code.

2. You can enumerate databases on the server by using SQLServer2.Databases collection.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Wodzu
Yak Posting Veteran

58 Posts

Posted - 2007-10-02 : 09:53:22

quote:
Originally posted by harsh_athalye

1. For checking whether connection to server is successful, you will have to handle the exception by writing exception handling code.



Thanks.

quote:
Originally posted by harsh_athalye

1. For checking whether connection to server is successful, you will have to handle the exception by writing exception handling code.



Why did you call that object "SQLServer2"? I have found info about "SQLDMO". What is the difference? Where can I found any description for this structures?

Is there a possibility to execute an Transact-SQL script via some of those object functions? For example, something like: SQLDMO.ExecuteTSQLFromFile('MyQuery.sql')





Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-10-02 : 09:57:51
Check this:
http://www.sqlteam.com/article/introduction-to-sql-dmo
http://msdn2.microsoft.com/en-us/library/aa258911(SQL.80).aspx


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Wodzu
Yak Posting Veteran

58 Posts

Posted - 2007-10-02 : 10:14:09
Thanks. I'am browsing it right now, however I can't find a way to pass a T-SQL script to the Database object. And creating a lot of tables with a lot of columns via DMO will be very long process :|
Go to Top of Page
   

- Advertisement -