sql server - Execute SELECT using SQLExecDirect -
I have the MSSQL database service in which the database created with ggg
table t1
is trying to execute SELECT
statement
RetCode = SQLExecDirect (hStmt, wszInput, SQL_NTS);
is the content of wszInput
Content has an error: >>
[42 s 02] [Microsoft] [SQL Server Native Client 11.0] [SQL Server] Invalid Object Name 'Jug. 1 '(208) SQL COMMAND & gt; Db.jig Choose from 1 *
Where's the problem?
You can use the database, schema , and then the table for this particular syntax Need to isolate. Your code should be (assuming that the default schema of
T1
dbo
is
SELECT * FROM ggg.dbo.t1 < / Code>
If you type
y
, SQL assumes that you currently talk about tables or views in the default (usually DBO) schema of the connected database are doing.If you type
xy
, SQL assumes that you are currentlyy
in they
schema of the associated databases. Talking about the table.If you type
x.dbo.y
, thex
database in thedbo
schema for a table named SQLy
will appear in
Comments
Post a Comment