Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SQLEXEC statement fails

SQLEXEC statement fails

SQLEXEC statement fails

What is wrong with this statement:

lnResult = SQLEXEC(oGv.pnConnhandle, 'EXEC ClientSecurity.UsersCloneSP','userz')

The stored procedure is qualified by a database schema name. Do I have to further qualify the stored procedure?

EXEC ClientSecurity.UsersCloneSP executes successfully in management studio query window.

RE: SQLEXEC statement fails

Find out yourself:


If lnResult<0
   ? laError(2)
   Set step on
Possible reasons I can think of only seeing your code: There are non optional parameters of this stored proc you need to pass in. You don't have access privileges as the user you connected to the server.

The error message will tell you more.

Bye, Olaf.

Olaf Doschke Software Engineering

RE: SQLEXEC statement fails

I added the database name to the stored procedure and it is now working.

lnResult = SQLEXEC(oGv.pnConnhandle, 'EXEC Hrmsdata.ClientSecurity.UsersCloneSP','userz')

RE: SQLEXEC statement fails

If you add Database=Hrmsdata to your connection string and you don't need to specify the database name in queries or EXEC calls. There also is a default schema for a user, which normally is dbo, that way the dbo prefix is usually optional and you can just use the core object name (table procedure name, view name, etc).

There's a little bit to learn about T-SQL names. But with the correct connection string, this also will work. And by the way, connecting to some specific database still makes it possible to change that. T-SQL USE database can be used. Unlike VFPs USE this switches the database, so it compares to VFPs SET DATABASE.

Bye, Olaf.

Olaf Doschke Software Engineering

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close