SQL问题-删除字段和电话号码格式的一部分 [英] SQL Question - Removing Part of a Field and Phone Number Format

查看:132
本文介绍了SQL问题-删除字段和电话号码格式的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQL表,该表是从Microsoft Dynamics Great Plains 2010导入到Visual Studio LightSwitch 2013中的.除了电话号码外,其他所有内容看起来都很不错……它们都是14位数字格式(最后一个数字代表分机号码)和LightSwitch 无法使用其自己的电话号码数据类型对此进行解析.

I've got a SQL table I've imported into Visual Studio LightSwitch 2013 that came from Microsoft Dynamics Great Plains 2010. Everything looks great except for Phone Numbers...they are all in a 14 digit format (last for digits for extension number) and LightSwitch cannot parse this with its own Phone Number data type.

我想知道是否有一个SQL命令可以在我的电话号码列(Phone1,Phone2,Phone3和Fax)上运行,该命令将删除最后一位数字.目前,它们显示为00000000000000.我在想是否可以删除最后4个LightSwitch 将正确解析.

I was wondering if there was a SQL command where I can run against the phone number columns (Phone1, Phone2, Phone3 and Fax) that would remove the last for digits. Currently they show as 00000000000000 . I am thinking if I can remove those last 4, LightSwitch will parse correctly.

作为参考,我尝试了以下方法:

For reference, I've tried the following:

我进入了对PHONE1的自定义验证,并尝试了以下方法:

I've got into custom validation for PHONE1 and tried this:

Select Case Left(PHONE1, 10)
End Select

没有变化.仍显示14位数字.

No change. Still shows 14 digits.

有人建议以下内容,但不确定在哪里使用

Someone suggested the following but not sure where to use this:

SELECT LEFT('HELLO WORLD', 3) = HEL

' OR 

SELECT SUBSTRING('HELLO WORLD',4,5)= LO WO
SELECT LEFT(phone_number,11) from table

基本上,我需要10位数字,然后在属性中选择正确的电话号码格式,以便它显示(xxx)xxx-xxxx.

Basically, I need 10 digits and then with proper Phone Number formatting selected in the properties, for it to appear (xxx) xxx-xxxx.

谢谢...
Brian

Thanks...
Brian

推荐答案

您尝试过仅添加电话号码掩码,应该可以正常显示.

Have you tried just adding a phone number mask, should work ok for display.

戴夫


这篇关于SQL问题-删除字段和电话号码格式的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆