Solved

Defining and Storing Input Mask

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

739 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