Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
CREATE TABLE [dbo].[BTU_MISReport](
[BusinessDate] [date] NULL,
[BRANCH_NAME] [nvarchar](max) NULL,
[BR_CODE] [nvarchar](50) NULL,
[Name_of_Valuer] [nvarchar](150) NOT NULL,
[ADDRESS] [int] NULL,
[LIST_OF_BR] [nvarchar](max) NULL,
[Score_Grade] [int] NULL,
[GoldSmith_PROP_NAME] [nvarchar](150) NOT NULL,
[Authorized_Signatory1] [int] NULL,
[Authorization_Date1] [int] NULL,
[Authorized_Signatory2] [int] NULL,
[Authorization_Date2] [int] NULL,
[Authorized_Signatory3] [int] NULL,
[Authorization_Date3] [int] NULL,
[FinalStatus] [int] NULL,
[Acknowledgement] [int] NULL,
[Date_of_HandinG] [int] NULL,
[Remarks_Anomalies] [int] NULL,
[Receiving_Date] [int] NULL,
[Intimation] [int] NULL,
[AgreementDate] [date] NULL,
[AgreementExpiryDate] [date] NULL,
[CancelledAgreement] [int] NULL,
[AgreementCancelIntimationDate] [int] NULL,
[Comments] [int] NULL,
[Reason] [int] NULL,
[Agreement] [varchar](17) NOT NULL,
[STATUS] [nvarchar](50) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

What I have tried:

I need to alter this table but also want to alter the columns datatypes for example
[ADDRESS] [int] NULL, to [ADDRESS] [nvarchar] (Max) NULL,

Please help me out in this matter.
Posted
Updated 26-Jul-18 1:11am

1 solution

SQL
ALTER TABLE MyTable
ALTER COLUMN ColumnName NVARCHAR(MAX);

A quick google would have found you that... SQL ALTER TABLE Statement[^]
 
Share this answer
 
Comments
Member 13926583 26-Jul-18 7:14am    
But its giving Syntax Error near [BusinessDate] [date] NULL,
whats the issue??
OriginalGriff 26-Jul-18 7:22am    
How do I know - I can't see the ALTER code you tried to use...
Naga Sindhura 1-Aug-18 3:31am    
check for other constraints exists in BTU_MISReport table. because above solution perfectly works for altering a table column datatype as follows
ALTER TABLE BTU_MISReport
ALTER COLUMN ADDRESS NVARCHAR(MAX);

syntax errors will always points to staring line of the code base. check-it once again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900