Intersoft Development, Inc. Home Link
If you are currently using SQL-Server for your business applications, are you sure you are realizing its full potential? SQL 2000 and 2005 are quite powerful, and now SQL Server 2008 extends this power...
Read More...
Intersoft Development emphatically recommends CodeGear Delphi for custom software development! With the newest Embarcadero Delphi 2010 release, Delphi continues its tradition of providing industry-leading unmatched software development capabilities in this RAD programming language and IDE.

Delphi 2010 builds upon the already excellent features and capabilities of Delphi 2009 by adding touch/gesturing support to recent Delphi language enhancements for Generics, Closures / Anonymous-Methods, Unicode, and much more...
Read More...
CEO's Blog Topics Below
Recent Blog Topics:
Looking for affordable professional 2D/3D CAD Software? VariCAD is a full-featured comprehensive 2D/3D CAD package offering:
  • Windows / Linux support
  • 3D modeling with automatic export 2D.
  • Sizing of mechanical components.
  • Plus, predefined library of commnon parts.
  • Quick and intuitive 3D/2D GUI
  • Compatibility with DWG, DXF, IGES, STEP and STL...

FREE 3D CAD Software Trial and Sale - VariCAD

Free Software, Source Code, and Best-Practice Documentation Index from your
Cleveland Software, Database, Web Design, Consulting, and SQL / Delphi Experts

SQL Server - User Defined Function:
Format Unformatted Phone Number

Convert an unformatted 10-character phone number (i.e., full phone number with area-code, but without
any "(" or ")" surrounding area-code, or dashes separating numbers), to a "(xxx) xxx-xxx" formatted layout.

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[udfFormatUnformattedPhone]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[udfFormatUnformattedPhone]
GO

/***************************************************************************************/
-- This function takes a 10-char phone number (i.e., full phone number with area-code, 
-- but without any  "(" or ")" surrounding area-code, or dashes separating numbers),
-- and formats it to a "(xxx) xxx-xxx"  formatted layout.
-- This routine ASSUMES all 10-chars are filled in at the start!
/***************************************************************************************/
CREATE FUNCTION udfFormatUnformattedPhone
	(@cPhone	CHAR(10))
	RETURNS		CHAR(14)
AS
BEGIN
	RETURN '(' + SUBSTRING(@cPhone, 1, 3) + ') ' + 
               SUBSTRING(@cPhone, 4, 3) + '-' + 
               SUBSTRING(@cPhone, 7, 4) 
END
 
.NET framework version: 2.0.50727.3615