Forum Discussion
SQL Server Management Studio fails to recognize the table
Hi, ALL,
'm C/C++ developer who is trying to write some application that will talk to SQL Server.
I have the server running and I have MS installed.
In the MS I opened a tab for a new query and issue:
CREATE TABLE "abcattbl"(abt_os tinyint, abt_tnam nchar(129) NOT NULL, abt_tid integer, abt_ownr nchar(129) NOT NULL, abd_fhgt smallint, abd_fwgt smallint, abd_fitl char(1), abd_funl integer, abd_fstr integer, abd_fchr smallint, abd_fptc smallint, abd_ffce char(18), abh_fhgt smallint, abh_fwgt smallint, abh_fitl char(1), abh_funl integer, abh_fstr integer, abh_fchr smallint, abh_fptc smallint, abh_ffce char(18), abl_fhgt smallint, abl_fwgt smallint, abl_fitl char(1), abl_funl integer, abl_fstr integer, abl_fchr smallint, abl_fptc smallint, abl_ffce char(18), abt_cmnt nchar(254) );
CREATE UNIQUE INDEX abcatt_x ON abcattbl( abt_os ASC, abt_tnam ASC, abt_ownr ASC ) WITH (IGNORE_DUP_KEY = ON);
I executed those and got "Completed successfully"
I refresh the table list and I see the table named abcattbl in the list.
Next I opened another tab and tried to issue following:
/****** Script for SelectTopNRows command from SSMS ******/
IF NOT EXISTS(SELECT * FROM abcattbl WHERE abt_tnam='abcatcol' AND abt_ownr='dbo') INSERT INTO "abcattbl" VALUES( 0, 'abcatcol', (SELECT object_id FROM sys.objects o, sys.schemas s WHERE s.schema_id = o.schema_id AND o.name = 'abcatcol' AND s.name = 'dbo'), '', 8, 400, 'N', 0, 0, 34, 0, 'MS Sans Serif', 8, 400, 'N', 0, 0, 34, 0, 'MS Sans Serif', 8, 400, 'N', 0, 0, 34, 0, 'MS Sans Serif', '' );
And I got "Invalid object name: abcattbl" and the table name is highlighted with the red squiggly,
So on one hand the table is created successfully, but trying to use it gives an error?
How to override this?
My system for development is dated - I;m on Win8,1 with SQL Server 2012 and SQL Server MS 11.0.
I have another problems with C++ code I'm wriiting, but its different and needs another thread...
Thank you,
2 Replies
- rodgerkongIron Contributor
Make sure your are using the database that you created the table, check the database name shown in the toolbar when you opening the second tab, or write a USE dbname on the top of your script.
- SivertSolemIron Contributor
SSMS can also have some weird caching issues with new objects.
Restart SSMS, and it might have resolved itself.