Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table structure using sp_help

Tags:

sql

sql-server

When I tried this query:

sp_help '[OG_System].[dbo].[tbl_act]'

This message appears:

Msg 15250, Level 16, State 1, Procedure sp_help, Line 48
The database name component of the object qualifier must be the name of the current database.

like image 771
ylleigh12 Avatar asked Apr 06 '15 06:04

ylleigh12


People also ask

What does Sp_help do in SQL?

Reports information about a database object (any object listed in the sys. sysobjects compatibility view), a user-defined data type, or a data type.

How do you show the structure of a table?

So desc or describe command shows the structure of table which include name of the column, data-type of column and the nullability which means, that column can contain null values or not. All of these features of table are described at the time of Creation of table.

How can I show the table structure in SQL Server query?

To show table properties in the Properties window. In Object Explorer, select the table for which you want to show properties. Right-click the table and choose Properties from the shortcut menu. For more information, see Table Properties - SSMS.


1 Answers

Because your target database is different than current database.

Use;

EXEC [ServerName].[DatabaseName].dbo.sp_help 'tbl_act'
like image 118
goGud Avatar answered Oct 12 '22 07:10

goGud