![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
plz suggest me the query
plz tel me that : suppose that i made a table in sql server 2005 an
there is a column name "department id"..... i want that who so ever enters the value in this column shoul prefix "DEP" and then 3nos...... it means that the format should be like this "DEP***" WHERE * ARE THE NOS........ OR is ther any way so that it wil automatically prefix "DEP"...otherwise it wil throw an error........ |
|
|||
|
Re: plz suggest me the query
CREATE TABLE [dbo].[Departments](
[DepartmentID] [nchar](6) NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Departments] WITH CHECK ADD CONSTRAINT [CK_Departments] CHECK (([DepartmentID] like 'DEP[0-9][0-9][0-9]')) GO ALTER TABLE [dbo].[Departments] CHECK CONSTRAINT [CK_Departments] GO |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|