Q 1: How to get columns of a table in Sql Server?
Ans : There are many ways to do this
All above queries are used to get columns of the given table.
Q 2: How to columns data type and NULL to NOT NULL (or NOT NULL to NULL)?
Ans:ALTER TABLE YourTableName ALTER COLUMN Column_Name DataType NOT NULL
Ans : There are many ways to do this
- EXEC sp_columns 'tbFeeStructure',null,null,null,0
- SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('dbo.yourTableName')
- sp_help yourTableName
- SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='YourTableName'
Q 2: How to columns data type and NULL to NOT NULL (or NOT NULL to NULL)?
Ans:ALTER TABLE YourTableName ALTER COLUMN Column_Name DataType NOT NULL
No comments:
Post a Comment