Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
CREATE TABLE [dbo].[Add_emp](
	[Sr_no] [int] IDENTITY(1,1) NOT NULL,
	[ID_no] [nvarchar](max) NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[F_name] [nvarchar](max) NOT NULL,
	[Designation] [nvarchar](max) NOT NULL,
	[Station] [nvarchar](max) NOT NULL,
	[pf_no] [nvarchar](50)PRIMARY KEY NOT NULL,
	[Department] [nvarchar](max) NOT NULL,
	[Dob] [nvarchar](50) NOT NULL,
	[Date_of_appoinment] [nvarchar](max) NOT NULL,
	[height] [nvarchar](50) NOT NULL,
	[body_mark] [nvarchar](max) NULL,
	[Address] [nvarchar](max) NOT NULL,
	[Ward_section] [nvarchar](max) NOT NULL,
	[image] [nvarchar](max) NULL,
	[cl] [int] NOT NULL DEFAULT(8) ,
	[lap] [int] NOT NULL DEFAULT(15) ,
	[Hlap] [int] NOT NULL DEFAULT(10) ,
 )

i have tried this but its giving me error
Posted
Comments
[no name] 23-Dec-13 7:04am    
And the error is? Maybe the last ","? [Hlap] [int] NOT NULL DEFAULT(10) , <<<<<
Maciej Los 23-Dec-13 7:07am    
Maybe? For sure!

SQL
CREATE TABLE [dbo].[Add_emp](
    [Sr_no] [int] IDENTITY(1,1) NOT NULL,
    [ID_no] [nvarchar](max) NOT NULL,
    [Name] [nvarchar](max) NOT NULL,
    [F_name] [nvarchar](max) NOT NULL,
    [Designation] [nvarchar](max) NOT NULL,
    [Station] [nvarchar](max) NOT NULL,
    [pf_no] [nvarchar](50)PRIMARY KEY NOT NULL,
    [Department] [nvarchar](max) NOT NULL,
    [Dob] [nvarchar](50) NOT NULL,
    [Date_of_appoinment] [nvarchar](max) NOT NULL,
    [height] [nvarchar](50) NOT NULL,
    [body_mark] [nvarchar](max) NULL,
    [Address] [nvarchar](max) NOT NULL,
    [Ward_section] [nvarchar](max) NOT NULL,
    [image] [nvarchar](max) NULL,
    [cl] [int] NOT NULL DEFAULT(8) ,
    [lap] [int] NOT NULL DEFAULT(15) ,
    [Hlap] [int] NOT NULL DEFAULT(10)

}

Try this code
 
Share this answer
 
Comments
Omprakash Kukana 24-Dec-13 3:04am    
Msg 102, Level 15, State 1, Line 20
Incorrect syntax near '}'.
Omprakash Kukana 24-Dec-13 3:05am    
but i solved this it was due to }
Omprakash Kukana 24-Dec-13 3:08am    
still default value is not inserting
SQL
ALTER TABLE [dbo].[Add_emp] ADD  CONSTRAINT [DF_Add_emp_cl]  DEFAULT ((8)) FOR [cl]
GO

ALTER TABLE [dbo].[Add_emp] ADD  CONSTRAINT [DF_Add_emp_lap]  DEFAULT ((15)) FOR [lap]
GO

ALTER TABLE [dbo].[Add_emp] ADD  CONSTRAINT [DF_Add_emp_Hlap]  DEFAULT ((10)) FOR [Hlap]
 
Share this answer
 

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