Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Defining and Storing Input Mask

Posted on 1998-08-24
1
Medium Priority
?
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
formula earned 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

705 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