SQL Server 2012 LIKE expression pattern -


I am working on an assignment for which I add an obstacle which ensures that all the values ​​in the column are fully Are numerical. Starting from Im

  Alternate table table_name ADD CONSTRAINT ck_name check (col_name such as 'pattern');   

The problem is that prices can vary in length, I am studying a lot but I can not understand a pattern that will limit it to numbers but still it is different in length I know in MySQL that you can do '[0- 9] *', but it does not work on SQL Server. Can someone point me in the direction of the equivalent or confirm that this is not possible / I misunderstood it?

EDIT: I have to use an obstacle as per the need of assignment.

you can do something like

  ALTER TABLE table_name ADD CONSTRAINT Ck_name CHECK (isGLEERIC (col_name)) & lt; & Gt; 0);   

(or something like)

  Add an optional table table_name; insert ck_name check (not call_name like '% [^ 0-9]%');    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -