473,378 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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........
Aug 15 '08 #1
2 1160
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
Aug 15 '08 #2
CREATE TABLE Foobar
( ..
department_id CHAR(6) NOT NULL
CHECK (department_id LIKE 'DEP[0-9][0-9][0-9]'),
Aug 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
2
by: srinivas | last post by:
HI, I am a dotnet developer.Ho we can do the functionality exists in google suggest site (http://www.google.com/webhp?complete=1&hl=en).In this site in search text box if we enter some text it...
1
by: vikjai | last post by:
HI all, I have to desing a database in access for HRD Department of a company.. and here the problem is that they want a facility so that they can increase the columns of the Employee table with...
5
by: gimme_this_gimme_that | last post by:
I'd like to create my own version of google suggest GS. If you haven't seen GS check it out at : http://www.google.com/webhp?complete=1&hl=en I've reviewed several AJAX write-ups on the...
4
by: somaskarthic | last post by:
Hi I posted query about dynamically generating php code. Sorry for the inconvenience . I didn't given you the php code. Its just javascript code which dynamically create rows on button click event....
1
by: somaskarthic | last post by:
Hi I submitted query regarding submitting dynamically generated elements.. pls read the post with the subject : submitting dynamically generated elements.. pls suggest Hope you reply soon...
11
by: alexs | last post by:
Hi, I've got a Java stored procedure that I use to "register" systems on our network. In the middle of it is a function that returns the 1st free ip address in a class C network which is used in...
2
by: nethravathy | last post by:
Hi, The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not. I tried with following query 1)SELECT...
16
by: Martin Wells | last post by:
I'm doing an embedded systems college project this year. I'm making a portable device that will take input in the form of simple switches, and give output in the form of LED's. Can you please...
0
by: shankarsunmicrosys | last post by:
Hi, I have my requirement as below. I have 10000 records coming from my select query.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.