Reputation: 12357
I'm reading the official Microsoft guide about sp_columns
and I'm trying to retrieve only one specific column from AdventureWorks2016.dbo.Person.Address
:
exec sp_columns @table_name = 'Person.Address', @Column_name = 'NULLABLE'
SSMS is retrieving all all columns as empty
The Microsoft documentation says I can use @Column_name
Upvotes: 0
Views: 255
Reputation: 76
If you execute this:
exec sp_columns @table_name = 'Address'
You should get the following:
How ever the @Column_name = 'NULLABLE'
does not exist in the table
And if you run the query with the correct name of the column you will get it working.
For example this:
exec sp_columns @table_name = 'Address', @Column_name = 'AddressID'
Upvotes: 1
Reputation: 46241
The @table_name
parameter value must be the table name alone. Specify the schema name separately using the @table_owner
column and specify the name of an existing column with the @column_name
parameter value:
exec sp_columns @table_name = N'Address', @table_owner = N'Person', @column_name = N'AddressLine1';
Schema and owner are conceptually different in modern SQL Server versions but this is a rather old stored procedure where schema and table owner are used interchangeably.
Upvotes: 1