Executing SQL PROCEDURE USING Microsoft Access 2010.

Is there you can execute SQL Store Proc sp_rename function from Microsoft Access ?

If so, then can anyone provide a simple snippet of what the syntax would look like.
ldcrayAsked:
Who is Participating?
 
Anthony PerkinsConnect With a Mentor Commented:
What object are you trying to rename?  From MS Access you can use some ADO code to execute the sp_rename system Stored Procedure.
0
 
Bill RossCommented:
Hi,

Create a new query...

Do not add any tables.

Select Pass-Through as query type in Design Tools.

Make the query text:

EXEC sp_YourSPName;

Open Properties wide.

Set ODBC Connect String to:

ODBC;Driver={SQL Server Native Client 10.0};Server=YourSQLServer;DATABASE=YourDatabasName;Trusted_Connection=True"

Save as SPPassThru and run the query as needed.

Note:  You can build a connection string using the ODBC wizard and/or you can modify the string per:

http://msdn.microsoft.com/en-us/library/ms130822.aspx

Regards,

Bill
0
 
ldcrayAuthor Commented:
I'm trying to rename table objects on a SQL 2008 R2 database.
0
 
Bill RossConnect With a Mentor Commented:
Hi,

Change the EXEC line above:

From:
EXEC sp_YourSPName;

To:
EXEC sp_rename 'YourExistingTableName', 'YourNewTableName';

Regards,

Bill
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.