Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How do I list all user tables in a SQL Server database? Once done I have to passon some commends also to all the listed tabled. I already have connection strings and also able to extract records as pe the criteria from one defined table but do not know how to loop thru the tables or table properties. Any pointers are appreciated. Regards, Madiya |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this
Set oConn = CreateObject("ADODB.Connection") oConn.Open sConnString Set oCat = CreateObject("ADOX.Catalog") Set oCat.ActiveConnection = oConn iRow = 1 For Each tbl In oCat.Tables If (tbl.Type < "SYSTEM TABLE") Then sTableName = tbl.name cLength = Len(sTableName) iTestPos = 0 iStartpos = 1 Debug.Print sTableName End If Next tbl oConn.Close Set oCat = Nothing -- HTH Bob "Madiya" wrote in message ... Hi, How do I list all user tables in a SQL Server database? Once done I have to passon some commends also to all the listed tabled. I already have connection strings and also able to extract records as pe the criteria from one defined table but do not know how to loop thru the tables or table properties. Any pointers are appreciated. Regards, Madiya |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mar 17, 9:43*am, Madiya wrote:
Hi, How do I list all user tables in a SQL Server database? Once done I have to passon some commends also to all the listed tabled. I already have connection strings and also able to extract records as pe the criteria from one defined table but do not know how to loop thru the tables or table properties. Any pointers are appreciated. Regards, Madiya Somebody working with VBA and SQL? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, I posted a reply yesterday.
Bob "Madiya" wrote in message ... On Mar 17, 9:43 am, Madiya wrote: Hi, How do I list all user tables in a SQL Server database? Once done I have to passon some commends also to all the listed tabled. I already have connection strings and also able to extract records as pe the criteria from one defined table but do not know how to loop thru the tables or table properties. Any pointers are appreciated. Regards, Madiya Somebody working with VBA and SQL? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mar 18, 8:29*pm, "Bob Phillips" wrote:
Yes, I posted a reply yesterday. Bob "Madiya" wrote in message ... On Mar 17, 9:43 am, Madiya wrote: Hi, How do I list all user tables in a SQL Server database? Once done I have to passon some commends also to all the listed tabled. I already have connection strings and also able to extract records as pe the criteria from one defined table but do not know how to loop thru the tables or table properties. Any pointers are appreciated. Regards, Madiya Somebody working with VBA and SQL? Bob, Thanks but I could not find your reply. Can you Pl post back here or give me link to that msg pl. Regards, Madiya |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This was it.
Try this Set oConn = CreateObject("ADODB.Connection") oConn.Open sConnString Set oCat = CreateObject("ADOX.Catalog") Set oCat.ActiveConnection = oConn iRow = 1 For Each tbl In oCat.Tables If (tbl.Type < "SYSTEM TABLE") Then sTableName = tbl.name cLength = Len(sTableName) iTestPos = 0 iStartpos = 1 Debug.Print sTableName End If Next tbl oConn.Close Set oCat = Nothing -- HTH Bob "Madiya" wrote in message ... On Mar 18, 8:29 pm, "Bob Phillips" wrote: Yes, I posted a reply yesterday. Bob "Madiya" wrote in message ... On Mar 17, 9:43 am, Madiya wrote: Hi, How do I list all user tables in a SQL Server database? Once done I have to passon some commends also to all the listed tabled. I already have connection strings and also able to extract records as pe the criteria from one defined table but do not know how to loop thru the tables or table properties. Any pointers are appreciated. Regards, Madiya Somebody working with VBA and SQL? Bob, Thanks but I could not find your reply. Can you Pl post back here or give me link to that msg pl. Regards, Madiya |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HELP: VBA Code to extract data from an SQL Server database and put it into Access Database | Excel Programming | |||
List external database Tables and Fields | Excel Discussion (Misc queries) | |||
Querying a SQL Server Database | Excel Programming | |||
How do I run a SQL query against a MS SQL Server database from exc | Excel Discussion (Misc queries) | |||
Excel Connecting to SQL Server Database - Need your Help | Excel Programming |