Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
maxzsim
 
Posts: n/a
Default execute stored procedure from excel

Hi,

I have created procedure ProcA that creates a table TblA in SQL

how do i call the stored procedure from Excel to execute that stored
procedure ?

appreciate any advise

tks & rdgs
  #2   Report Post  
Gary Brown
 
Posts: n/a
Default

You've posted 63 questions to this forum and never indicated that anyone had
ever answered your question satisfactorily?

That said...
I THINK you might want to try...

DATA / GET EXTERNAL DATA / RUN SAVED QUERY

HTH,
--
Gary Brown



"maxzsim" wrote:

Hi,

I have created procedure ProcA that creates a table TblA in SQL

how do i call the stored procedure from Excel to execute that stored
procedure ?

appreciate any advise

tks & rdgs

  #3   Report Post  
maxzsim
 
Posts: n/a
Default

Hi Gary,

My appologies for posting the same question in Excel - Programming as i
tot i have posted but yet i could not find my posting

as for my indication of whether the reply has been successful , i did not
realise that i actually need to do that

as for my ques , is there any way to do it programmatically ?
this is how i write my code :

====================================
Dim strConn As String
Dim con As Connection
Dim comm As ADODB.Command
strConn = "Provider=SQLOLEDB;Data Source=SvrA;InititalCatalog
=master;uid=;pwd="

Set con.Execute = strConn
Set comm = New Command
comm.ActiveConnection = con
comm.CommandText = "SQL1.master.dbo.Usr_GetUserAccess"
comm.CommandType = adCmdStoredProc
'comm.ActiveConnection = strConn
comm.Execute strConn

Set rs = New ADODB.Recordset
rs.Open "Select * from [UserAccess]", con

=====================================

but i have some problem using the connection objects

appreciate your advise
rdgs,

"Gary Brown" wrote:

You've posted 63 questions to this forum and never indicated that anyone had
ever answered your question satisfactorily?

That said...
I THINK you might want to try...

DATA / GET EXTERNAL DATA / RUN SAVED QUERY

HTH,
--
Gary Brown



"maxzsim" wrote:

Hi,

I have created procedure ProcA that creates a table TblA in SQL

how do i call the stored procedure from Excel to execute that stored
procedure ?

appreciate any advise

tks & rdgs

  #4   Report Post  
Gary Brown
 
Posts: n/a
Default

Try turning on the Macro Recorder...
TOOLS / MACRO / RECORD NEW MACRO
Then run your query using...
DATA / GET EXTERNAL DATA / RUN SAVED QUERY
Then review the code that was created. It may put you on the right track.
HTH,
--
Gary Brown



"maxzsim" wrote:

Hi Gary,

My appologies for posting the same question in Excel - Programming as i
tot i have posted but yet i could not find my posting

as for my indication of whether the reply has been successful , i did not
realise that i actually need to do that

as for my ques , is there any way to do it programmatically ?
this is how i write my code :

====================================
Dim strConn As String
Dim con As Connection
Dim comm As ADODB.Command
strConn = "Provider=SQLOLEDB;Data Source=SvrA;InititalCatalog
=master;uid=;pwd="

Set con.Execute = strConn
Set comm = New Command
comm.ActiveConnection = con
comm.CommandText = "SQL1.master.dbo.Usr_GetUserAccess"
comm.CommandType = adCmdStoredProc
'comm.ActiveConnection = strConn
comm.Execute strConn

Set rs = New ADODB.Recordset
rs.Open "Select * from [UserAccess]", con

=====================================

but i have some problem using the connection objects

appreciate your advise
rdgs,

"Gary Brown" wrote:

You've posted 63 questions to this forum and never indicated that anyone had
ever answered your question satisfactorily?

That said...
I THINK you might want to try...

DATA / GET EXTERNAL DATA / RUN SAVED QUERY

HTH,
--
Gary Brown



"maxzsim" wrote:

Hi,

I have created procedure ProcA that creates a table TblA in SQL

how do i call the stored procedure from Excel to execute that stored
procedure ?

appreciate any advise

tks & rdgs

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
I get a program error when I download an excel template Ladybug Excel Discussion (Misc queries) 3 March 4th 05 12:02 AM
Opening an Excel file Sheldon Zaklow Excel Discussion (Misc queries) 0 March 3rd 05 10:29 PM
Difference in number of Excel NewsGroups Hari Prasadh Excel Discussion (Misc queries) 1 January 25th 05 11:32 AM
Fonts get size 1 and can't be changed after a procedure - even by excel GUI!! Marie J-son Charts and Charting in Excel 2 December 6th 04 04:11 AM


All times are GMT +1. The time now is 02:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"