Click to See Complete Forum and Search --> : Table Search
swalker
November 30th, 2003, 04:06 AM
My Database contains tables like -> "434_23July2003_00:53:05"
434_23July2003_11:53:05..
434 is an unique ID.
Withing my program im getting a specific date from the user ( Eg. 434_23July2003) without time. and I wanna search weather any database is available for that spesific date. ( not considering about time) and get the table list.
raghupathys
December 1st, 2003, 01:35 AM
try this query, it will return the name of all the tables in the db with a matching name
select name from sysobjects where xtype = 'u' and name like '434_23July2003%'
this will return the names of all the user tables with name starting with 434_23July2003
Hope this helps
swalker
December 1st, 2003, 01:49 AM
yea its working .. how can I use this within VB to get the list of search result
raghupathys
December 2nd, 2003, 06:26 AM
u can try this piece of code
dim dbConn as new adodb.connection
dim dbRecSet as adodb.recordset
dbconn.open "Provider=SQLOLEDB;Source=(local);Database=master;UID=sa;PWD=;"
set dbRecSet = dbconn.execute "select name from sysobjects where xtype = 'u' and name like '434_23July2003%'"
do while not dbRecSet.eof
msgBox dbRecSet!name
dbRecSet.MoveNext
loop
so now dbRecSet will contain the list of names. Of course you will have to enter the correct details in the connection string.
hope this helps
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.