Solved

Defining and Storing Input Mask

Posted on 1998-08-24
1
227 Views
Last Modified: 2010-03-19
Hi,
I have just started to use SQL server 6.5.  While designing the database in want to sotre the Department code with follwoing input mask ##-###
In access97 i was able to store the input mask with the data so i did not have to format the output evertime.  Is it possible to do the same in SQL Server.  If yes then how and where?
thanks in adv.
msa.
0
Comment
Question by:msali
1 Comment
 
LVL 2

Accepted Solution

by:
formula earned 50 total points
ID: 1089724
You can't store input masks in SQL Server to my knowledge.  But
you could retrieve or store your data like you want it as follows:

select (substring(deptcode,1,2)+"-"+substring(deptcode,3,3)) deptcode from table

or

update table
set deptcode=
(substring(deptcode,1,2)+"-"+substring(deptcode,3,3))

I'm assuming your deptcode is a character field. You could not
store a dash in a numeric, but you could retrieve it by using
convert and string functions.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now