Solved

Defining and Storing Input Mask

Posted on 1998-08-24
1
248 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

813 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

11 Experts available now in Live!

Get 1:1 Help Now