Creating a Sql7 Database Through ODBC

Creating a Sql7 Database Through ODBC

Post by Craig Hurcu » Thu, 10 Jun 1999 04:00:00



We have an application that creates a database via ODBC connection. I'm
currently re-writing this to suit Sql Server 7.

The user enters details such as database name, location of the file,
size etc.

Is there any way of validating the path for the database file before
attempting to create the database.

 
 
 

Creating a Sql7 Database Through ODBC

Post by Neil Pik » Thu, 10 Jun 1999 04:00:00


Craig,

 xp_getfiledetails

Quote:> Is there any way of validating the path for the database file before
> attempting to create the database.

Q.     How can I get file information using SQL Server?
(v1.0 1999.05.04)

A. Using the undocumented xp_getfiledetails procedure :-

create table #info (
   alt_name            varchar(255) null,
   size_in_bytes       int null,
   creation_date       int null,
   creation_time       int null,
   last_written_date       int null,
   last_written_time       int null,
   last_accessed_date  int null,
   last_accessed_time  int null,
   attributes          int null
)

insert #info exec master..xp_getfiledetails 'C:\Directory\File.nam'

 Neil Pike MVP/MCSE.  Protech Computing Ltd
 (Please post ALL replies to the newsgroup only unless indicated otherwise)
 For SQL FAQ entries see
 http://go.compuserve.com/sqlserver (library 1) - latest stuff is always here
 www.ntfaq.com/sql.html
 http://www.swynk.com/faq/sql/sqlserverfaq.asp

 
 
 

Creating a Sql7 Database Through ODBC

Post by Craig Hurcu » Sat, 12 Jun 1999 04:00:00


Thanks Neil, works a treat.

Cheers

Craig