SELECT TABLE_NAME, COLUMN_NAME,DATA_TYPE , CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'WS_Account' AND COLUMN_NAME = 'Account_Name'
***Should be set to 256, example below
The table will need to be dropped and recreated.
--- Check column for type and length ---
SELECT TABLE_NAME, COLUMN_NAME,DATA_TYPE , CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'WS_Account' AND COLUMN_NAME = 'Account_Name'--- Check to see if there are records in the table --
select * from ws_account--- If records exists backup the table. ---
/****** Backup Existing table ******/ Select * into WS_Account_Account_Name_Fix from WS_Account /****** Rename Existing table ******/ EXEC sp_rename 'WS_Account', 'WS_Account_Old'; /****** Create New WS_Account Table ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[WS_Account] ( [Account_Id] [int] IDENTITY(1,1) NOT NULL, [Customer_Id] [int] NOT NULL, [Account_Name] [varchar](256) NOT NULL, [Account_PWD] [varchar](15) NOT NULL, [Customer_Contact_Id] [int] NOT NULL, [Inactive] [char](1) NULL, [Field_Comments] [char](1) NULL, [Last_Login] [datetime] NULL, [Inactive_Since] [datetime] NULL, [Inactivated_By_Account_Id] [int] NULL [PswUpdDate] [datetime] NULL, [PswUpdUser] [nvarchar](50) NULL, [Upd_SedonaCloud] [bit] NULL, [Last_Accountname] [varchar](256) NULL, [Token_Request] [nvarchar](200) NULL ) ON [PRIMARY] GO /****** Insert Old Records if Needed******/ SET IDENTITY_INSERT WS_Account on GO INSERT INTO WS_Account (Account_Id, Customer_Id, Account_Name, Account_PWD, Customer_Contact_Id, Inactive, Field_Comments, Last_Login, Inactive_Since, Inactivated_By_Account_Id) SELECT Account_Id, Customer_Id, Account_Name, Account_PWD, Customer_Contact_Id, Inactive, Field_Comments, Last_Login, Inactive_Since, Inactivated_By_Account_Id FROM WS_Account_Account_Name_Fix GO SET IDENTITY_INSERT Ws_Account off GO--- Verify records were imported ---
select * from ws_account