WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Create_date From SQL Server Table Properties

 Keywords: OLE ADO 'Created date' SQL Server Table Properties Express SQLOLEDB.1 {SQL Server}

Question:

Has anyone written an OLE script to get 'Created date' from SQL Server Table properties?

Answer:

Sample 1:Yusing SQL Server Express:
svr=".\SQLEXPRESS"
cConn="Provider=SQLOLEDB.1;Data Source=":svr:";Database=master;Integrated Security=SSPI;Persist Security Info=False"
oRS=CreateObject("ADODB.Recordset")
oRS.ActiveConnection = cConn
oRS.Source = "SELECT name,create_date FROM sys.Tables"
oRS.CursorType = 0
oRS.CursorLocation = 2
oRS.LockType = 1
oRS.Open()
txt=oRS.GetString()
oRS.Close()
oRS=0
Message("",txt)
Exit


Sample 2:
CONN_STRING = "Driver={SQL Server};Server=serverpath;Database=dbname;Uid=userid;Pwd=password;"

; Query the sys.Tables:
objTables = CreateObject("ADODB.Recordset")
objTables.ActiveConnection = CONN_STRING
objTables.Source = "SELECT create_date FROM sys.Tables"
objTables.CursorType = 0
objTables.CursorLocation = 2
objTables.LockType = 1
objTables.Open()

While !objTables.EOF
 date = objTables.Fields.Item("create_date").Value
 Pause("Create date", date)
 objTables.MoveNext()
EndWhile

; close the recordset:
objTables.Close()
objTables = 0





Article ID:   W18037
Filename:   Get Create_date From SQL Server Table Properties.txt
File Created: 2013:01:14:08:58:26
Last Updated: 2013:01:14:08:58:26