• and some ready made code to test it: creates a rule and a column that uses it:

    CREATE RULE [dbo].[NumericCharsOnly]

    AS

    --@value NOT LIKE '%[0-9,-+]%' ESCAPE '!' --bad way...minus and spec chars need to be first!

    @value NOT LIKE '%[^-+,0-9]%' ESCAPE '!'

    GO

    --create a "type" , and bind the rule to teh type

    CREATE TYPE [dbo].[numchar] FROM [varchar](20) NULL

    GO

    EXEC sys.sp_bindrule @rulename=N'[dbo].[NumericCharsOnly]', @objname=N'[dbo].[numchar]' , @futureonly='futureonly'

    GO

    --a simple test table.drop table example

    create table example(exampleid int identity,test numchar)

    --insert some test data.

    insert into example(test) values ('0000')

    GO

    insert into example(test) values ('00a00') --fails! all is good

    GO

    insert into example(test) values ('0000&444') --fails as expected

    GO

    insert into example(test) values ('-0000') --failed when i did not want it too

    GO

    insert into example(test) values ('+0000') --failed when i did not want it too

    GO

    drop table example

    drop type [numchar]

    drop rule [NumericCharsOnly]

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!