Solved

Defining and Storing Input Mask

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

734 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