using a SP ??

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

when creating an SqlCommand do I use the name of a stored procedure :
'mytable'

Now, I've seen (working) code where that SP is preceded by the name of a
user :
'user1.mytable'

I try it at home ... hence I've created 'user1' in the DB (with dbo rights
on myDB) but when executing the command do I get a :
Could not find stored procedure 'user1.mytable'

How come ?

thanks

Christian
 
You need to create the stored procedure with the qualified name, otherwise
it uses dbo as default (I think):
CREATE PROCEDURE user1.mytable

Hope it helps
/Dan
 
You are probably doing something like this:

cmd.CommandText = "user1.MyTable";

That means nothing unless you do something like:

cmd.CommandType = CommandType.Table;

Not a wise strategy either way. You need to set up a SQL command.

Now, if you are trying to set up a stored procedure, you will have to
actually write the T-SQL for the stored procedure prior to running it. If
you are simply running the "SQL" command "user1.MyTable" it will assume you
are running a stored proc, as there is no T-SQL syntax that automagically
pulls from any other type of object.

Hope this makes sense.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
Back
Top