SQL Server Error: "Cannot use empty object or column names"

I am getting the following error:

Cannot use empty object or column names. Use a single space if necessary.
Msg 1038, Level 15, State 3, Line 1

      

and the request command looks like this:

SELECT TOP 100 PERCENT
  [].[cms_page].[pa_id], [].[cms_page].[pa_key], 
  [].[cms_page].[pa_title], [].[cms_page].[pa_keywords], 
  [].[cms_page].[pa_description], [].[cms_page].[pa_header], 
  [].[cms_page].[pa_created], [].[cms_page].[pa_modified], 
  [].[cms_page].[pa_language] FROM [cms_page] 
WHERE 
  [cms_page].[pa_key] = @pa_key0 
ORDER BY 
  [pa_id] ASC;

      

It's strange. Why is this happening? I am using SubSonic 2.1.

ConnectionString:

<add name="OCDB" connectionString="Network Library=DBMSSOCN;Data Source=127.0.0.1,1433;Initial Catalog=test_db;User ID=test;Password=testpwd"/>

      

Edit: Well, the solution was simply to create and rebuild the data access layer and I was good to go.

+1


a source to share


4 answers


You seem to be using a 3-part name, part of which is empty, i.e. '[].'



+1


a source


It looks like the query text is being built with an empty table schema.



These empty square brackets [] must contain something like "dbo" to make the query syntactically valid. I don't know enough about SubSonic to give you a sample code though.

0


a source


I'm not familiar with SubSonic, but have you tried a simpler query to check if your syntax is correct? Does this query even work in SQL Server (Management Studio / Query Analyzer)?

Just looking at this from a SQL Server perspective, you are using too many parentheses. If I were writing this query in SQL Server, it would be similar to what I wrote below. I'm not sure about the @ pa_key0 variable, is this part of the query a stored procedure or is SunSonic replacing this variable when running the query?

SELECT
  pa_id, 
  pa_key, 
  pa_title, 
  pa_keywords, 
  pa_description,
  pa_header, 
  pa_created,
  pa_modified, 
  pa_language 

FROM 
  cms_page

WHERE 
  pa_key = @pa_key0 

ORDER BY 
  pa_id ASC;

      

0


a source


I think you need to set the schema for Subsonic. This thread seems to have some information:

Subsonic - How to use SQL schema name / owner as part of namespace?

0


a source







All Articles