CONSTRAINT rule of no special characters allowed? Help

ALTER TABLE dbo.tblasset ADD CONSTRAINT
CK_tblasset_HardwareNumber CHECK ([HardwareNumber]<>'' and [HardwareNumber] is not null)
GO
Is there away I can implement special characters being inputted on a NVARCHAR datatype using this?special characters like (* , . ,")Many thanks

ALTER TABLE dbo.tblasset ADD CONSTRAINT
CK_tblasset_HardwareNumber CHECK ([HardwareNumber]<>'' and [HardwareNumber] is not null)
GO
Is there away I can implement special characters being inputted on a NVARCHAR datatype using this?special characters like (* , . ,")Many thanks
Your can create a Check
Constraint on this column and only allow Numbersand Alphabets to
be inserted in this column, see below:
Check Constraint to only Allow Numbers & Alphabets
ALTER TABLE Table_Name
ADD CONSTRAINT ck_No_Special_Characters
CHECK (Column_Name NOT LIKE '%[^A-Z0-9]%')
Check Constraint to only Allow Numbers
ALTER TABLE Table_Name
ADD CONSTRAINT ck_Only_Numbers
CHECK (Column_Name NOT LIKE '%[^0-9]%')
Check Constraint to only Allow Alphabets
ALTER TABLE Table_Name
ADD CONSTRAINT ck_Only_Alphabets
CHECK (Column_Name NOT LIKE '%[^A-Z]%')
Source: http://stackoverflow.com/questions/25408483/create-rule-to-restrict-special-characters-in-table-in-sql-server
web: www.ronnierahman.com

Similar Messages

  • SRT Framework exception: ICF: Error when creating service node. [rc:wrong_icf_name] No special characters allowed in name

    Hi,
    I have created a web service in SAP ECC from a RFC.
    While configuring the web service in SOA management to publish it, getting error SRT Framework exception: ICF: Error when creating service node. [rc:wrong_icf_name] No special characters allowed in name
    How to resolve the same.
    Thanks
    Tanmay

    Hello Tanmay,
    Are you including quotes (') in the name, I assume not?
    Regards,
    Siddhesh

  • Spry Validation - Special Characters

    Hi Chaps,
    I'm looking for two validation scritps:
    1. Text field must have a '/' (forward-slash) at end of string
    2. No special characters allowed (forward, backward slashes, question marks, etc..)
    Any hints or answers would be most appreciated.
    Cheers

    littlemookie wrote:
    Hi Chaps,
    I'm looking for two validation scritps:
    1. Text field must have a '/' (forward-slash) at end of string
    2. No special characters allowed (forward, backward slashes, question marks, etc..)
    Any hints or answers would be most appreciated.
    Cheers
    Hi,
    The validation script could be similar to:
    <script>
    function myValidation(value) {
       return /^[a-zA-Z0-9\s.\-]+$/.test(value); // ANY alphanumeric string with spaces, commas, dashes from http://regexlib.com/
    </script>
    The constructor will look like
    <script>
        var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "custom", {validation: myValidation, validateOn:["blur", "change"]});
    </script>
    The only thing missing here is the compulsory forward-slash at the end of the string, but if that is important then you could alway script that into the value of the text field. For further info regarding regular expressions goto http://regexlib.com.
    I hope this helps.
    Ben

  • Function Module tto check special characters in a field

    Hi All,
    I have a requriemnt where i need to make sure there are no special characters allowed
    in a paremeter ( is there any functional module to check it)
    r anyway to work with
    Thank in advance for u replies.
    Regards,
    Riyaz.

    DATA: vergleich_string(100) VALUE
              'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
      CONCATENATE vergleich_string ' 1234567890,./!@#$%&*-_+=~|\[{]}()"'
                                                   INTO vergleich_string.
    use condition.
    if var ca vergleich_string.
    raise error message.
    endif.

  • Finding special characters in the column

    Hi,
    Need a help to find out the special characters in the column. since the data is loaded from external files like excel etc.., there
    are some special characters are got inserted in the column.
    how do i find out the rows in the column which has special characters, Please help ASAP...
    Thanks

    Hi,
    What do you mean by "special characters"?
    SQL> With T As(Select 'A?BC' txt from dual union all
      2            Select 'AB%C' txt from dual union all
      3            Select 'ACAA' txt from dual)
      4  Select txt from t where Regexp_Like(txt,'[[:punct:]]');
    TXT
    A?BC
    AB%C
    [:punct:]      Punctuation symbols
                    % . , " ' ? ! : # $ & ( ) * ;
                    + - / < > = @ [ ] \ ^ _ { } | ~
    {code}
    Regards,
    Christian Balz                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Special characters - LSMW

    Hello,
    Does LSMW with direct input accept special characters ? I have lot of special characters in my descriptions, manufacturer details, model nos etc... like ",#&$%....I am just curious system accepts them during load.
    Mahee

    Hello
    It should work but need to take care that at start or begining of description no special characters allowed.

  • [HELP] Incoming SMS problem with special characters

    Hello,
    I have my BlackBerry Q10 for 4 days and I'm geting used to it and I love it but that's not the case...
    I live in Latvia and we use special letters in our language input like
    "ā č ē ž ļ ņ š ī ķ ģ ū" and that's alright with me, I know that I can't send these letters with my blackberry!
    But everytime my girlfriend sends me messages that are larger than two sentences and with these special letters... then I just can't read them at all. It looks like this:
    As you can see in image 1 & 2 there are @ symbols between every letter and other symbols.
    In the second image there you can see that the first sentence is taken from the same sms which is in image 1, it's just separated, It would be annoying to separate every single message someone sends me!!!!
    And in this image 3 below, you can see the correct text which is shown in image 2 with @ symbols between the letters...
    Please, I would appreciate it if someone could help me with this problem, it's annoying!
    P.S. And yes I have "Allow Special Characters" turned from OFF to ON in Text Messages>Settings>Advanced and it DIDN'T HELPED!
    Don't know what else to do!!!

    Ok, solved:
    From, DW do Edit | Preferences | New Document and set the Default Encoding to
    whatever you wish it to be.  That will set the default for all new
    documents in Dreamweaver.
    For the existing pages, you will need to open them and do Modify | Page Properties | Title/Encoding to set the encoding as you desire.

  • Need help in using replace function with special characters

    I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
    The data looks like this:
    CREEK&#39;S LANE
    ie for a street named CREEK'S LANE.
    I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
    When I try the query below I get prompted for substitution variable value.
    I don't seem to be able to find the right syntax to make this query work.
    SELECT REPLACE (street_name, '&#39;', '''')
    FROM
    streets WHERE street_id = 1
    Does anybody know how to do this?
    Any help would be much appreciated.
    Thanks.
    George

    george91 wrote:
    I have a column in a table where the data can contain ascii code for special characters such as an apostrophe.
    The data looks like this:
    CREEK'S LANE
    ie for a street named CREEK'S LANE.
    I want to replace the ascii representation with the apostrophe and have the returned data show up as: CREEK's LANE
    When I try the query below I get prompted for substitution variable value.
    I don't seem to be able to find the right syntax to make this query work.
    SELECT REPLACE (street_name, ''', '''')
    FROM
    streets WHERE street_id = 1
    Does anybody know how to do this?
    Any help would be much appreciated.
    Thanks.
    GeorgeHa! The codes you specified rendered in the HTML, but showed properly when I listed your original posting above. I didn't understand what you meant initially because the 5-character string represenation got rendered as the quote that you said you weren't able to get - a display problem.
    You're getting prompted for the substituon variable because of the ampersand; you appear to be doing this in SQL*PLUS. The first thing I would try is to SET DEFINE OFF when using the ampersands to see if that works. If That doesn't work check the docs to delmit the ampersand (I think its a backslash before it but can't remember offhand). Another, harder option might be to use the TRANSLATE function replacing the literal character instead of using REPLACE (though replacing a quote will be a little tricky). If you're on 10g also consider using the advanced quoting
    Good luck!
    Edited by: riedelme on May 22, 2009 12:45 PM

  • Create / Alter user doesn't allow special characters in password

    When i try to change the password from say : vos1s05 to : vos1s05! i get the error message (missing or invalid option), i have used several special characters and all give the same error, is there a way to circumvent this, or will this be enabled in a new release ??

    A password is classified as an oracle identifier and must conform to the rules for indentifiers. To include special characters you need to enclose it in double quotes e.g. "vos1s05!"

  • Special Characters and spaces in Tablenames and Column Names are allowed ?

    Hi
    I have created two tables in Oracle10g
    as follows
    SQL> create table test(columna number,columnb varchar2(20),primary key(columna));
    Table created.
    SQL> insert into test values(1,'test');
    1 row created.
    SQL> commit;
    COMMIT är utfört.
    SQL> create table "test quote"("#" number,abc number,primary key("#"));
    Table created.
    SQL> insert into "test quote" values(1,2);
    1 row created.
    SQL> commit;
    COMMIT är utfört.
    SQL> select * from "test quote";
    # ABC
    1 2
    SQL> select * from test;
    COLUMNA COLUMNB
    1 test
    Now I want to cache the tables and their data into TimesTen
    The cache group for table test which is not having any spaces and special characters in table name and column names is created perfectly.
    But when I create the cache group for table "test quote" which is having special characters and spaces it gives error :
    Command>create readonly cache group w2 from testuser.test(columna number,columnb varchar2(20),primary key(columna));
    Command>select * from test;
    <1,test>
    1 row found.
    Command>create readonly cache group w3 from testuser."test quote"("#" number,abc number,primary key("#"));
    5140: Could not find TESTUSER.TEST QUOTE in Oracle. May not have privileges.
    Command Failed.
    Now there is contradiction that why cache group for table test is created successfully and why it is not being created for table "test quote".
    What I think is if special characters and spaces in column names and table names are possible in Oracle then it sould be possible in TimesTen.
    Any possible solution.
    Looking forward for your reply.
    Please help I am stuck badly.
    /Ahmad

    Hi
    Problem Solved ....... Remeber only Capital letters work with special characters ......
    /Ahmad

  • Not allowed Special characters

    Hi Gurus,
    iam getting an error while activating the DSO request
    The error is 
    u201CValue 'E Byron Car Realignment' (hex. '450020004200790072006F006E002000430061007200200052') of characteristic ZCOITEMTX contains invalid charactersu201D
    I donu2019t understand what invalid character it is containing
    Apart from this I am getting error for the special character u201C|u201D
    How to use both the special characters at RSKC
    Please suggest
    Thank you

    Hi,
         According to me ZCOITEMTX is not allowing lower case. you can check for this infoobject in RSD1, at General tab Lowercase Letter check box is check or not?
    this will solve your issue.
    regards,

  • GoLive CS2 doesn't seem to encode special characters - help!

    If you've recently upgraded to CS2 and are having trouble with HTML entities for special characters, see this FAQ topic:
    FAQ 11.11 - Special Character Encoding Problems (CS2)
    Looks like this is going to be a recurring topic for a while as people migrate to CS2, so I'm making this a "sticky" topic at the top of the forum (thanks Martin).

    Thank you all for your posts on this issue. I need to point out a few things.
    1. As a novice, I had assumed that "special characters" included all non-standard characters (those not included in the Basic Latin character set and the Latin-1 Supplement set), and that therefore, all the "other" Unicode characters were special characters. As a result, I had assumed that the original post about Special Characters did indeed have a connection to Unicode input methods. (In fact, I am utterly in the dark as to why it is that it does not. But being a novice I believe you when you say that "special characters" and Unicode characters are two unrelated things, although I have no idea what the difference is. But, for letting me know that there is a difference, for that I truly thank you.
    2. I have read and re-read my comments from earlier and fail to see any "flaming" in it of Nate. Yet the rest of you see it clearly, so it must be there. It must be very disappointing for you to try so hard to help others only to be confronted with someone of ill-manners blasting you for your best efforts. I am truly sorry that I have in my ignorance and in my own frustration caused you to feel this way. Furthermore, since his statements had nothing to do with the issue that is so vexing to me (as you have now shown me), it was completely inappropriate for me to be upset with his answers.
    3. I remain very frustrated with not being able to find an answer to this problem of Unicode entry. I share Dee Bolland's aggravation when he talked about "... patronising people saying 'Didn't you know that?' blah blah." and when he said, " Please don't say 'It works for me!' :< ." When I first read Nate's statement of what to do about special characters, my spirits were excited with hope that it would solve my Unicode issues (because I thought he was talking about that). I was hopeful that I had missed something simple. When I tried it and it didn't work for my problem, I was very disappointed. This is the same frustration that I had when I read Rob Keniger's statement to me that the program can accept input in Source view. I jumped at this with hopeful anticipation, only to be totally and utterly disappointed once again--because it doesn't work for me. I pasted the Unicode text that I had posted above ( ×ֲש×ֶר ×Ö¹× ×Ö¸×Ö·×Ö° ×ַּעֲצַת רְש×ָעִ×× ) into source view, and all I got was the following: "
      " (I've included the tags so you can see the space). In other words, once again my high hopes are dashed and I am left feeling stupid (you say it works for you) and angry such a great program that does so many fantastic things can't do the basic things I want it to do. So, yes, I remain infuriated by the situation, by my inability to get the program to do what (I thought) you all had said it can so easily do. And yet (as I stated earlier in my post to Nate at which he took offense): "I do hope I am missing something simple and that the error is totally mine. However, I have yet to see any directions or examples that will solve the problem. Please, if you know of how to make this work, let me know. I will gladly confess my error in doubting you, if you can show me I am wrong by doing it right."
    So, since my post was not germane to the discussion, I will now bow out of this one. Thank you so much for your efforts to help, though.

  • C# PreviewKeyDown Event - Allow Special Characters

    Hello,
    I have a textbox and a PreviewKeyDown Event in which i want to allow Special Characters,A-Z and 0-9 only. Other keys such as keyboard modifiers, F1-F12, Esc,Tab, etc are not allowed.
    private void PART_SearchText_PreviewKeyDown(object sender, KeyEventArgs e)
    TextBox searchTextBox = sender as TextBox;
    if (((e.Key >= Key.A && e.Key <= Key.Z)
    || (e.Key >= Key.D0 && e.Key <= Key.D9)
    || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)
    || (e.Key == Key.Back || e.Key == Key.Delete))
    && (Keyboard.Modifiers != ModifierKeys.Shift)
    && (Keyboard.Modifiers != ModifierKeys.Alt)
    && (Keyboard.Modifiers != ModifierKeys.Control)
    && (Keyboard.Modifiers != ModifierKeys.Windows)
    && (searchTextBox.SelectedText.Length > 0 && searchTextBox.Text.Length > 0)
    && (searchTextBox.SelectedText.Length == searchTextBox.Text.Length))
    if (SearchDeletionCommand != null)
    searchTextBox.IsReadOnly = false;
    SearchDeletionCommand.Execute(null);
    The issue I am facing when hitting special characters (!,@,#...).
    So on my laptop if i press Shift 1, i am eventually entering a punctuation mark (!) and that should work. But in above code what happens is that the conditions does not get satisfied.
    Thanks,
    Abdi

    Thanks.
    I was thinking to use ascii values. 
    private void PART_SearchText_PreviewKeyDown(object sender, KeyEventArgs e)
    TextBox searchTextBox = sender as TextBox;
    int ascii = KeyInterop.VirtualKeyFromKey(e.Key);
    if (ascii >= 32 && ascii <= 127 && (searchTextBox.SelectedText.Length > 0 && searchTextBox.Text.Length > 0)
    && (searchTextBox.SelectedText.Length == searchTextBox.Text.Length))
    if (SearchDeletionCommand != null)
    searchTextBox.IsReadOnly = false;
    SearchDeletionCommand.Execute(null);
    I am using  int  ascii = KeyInterop.VirtualKeyFromKey(e.Key); to get the ascii value but it does not give me the correct ascii values. For eg.. ascii value for comma is generally 88 but over here it gives me 148 or something. And that is when my
    logic above fails.
    Is there any workaround for this?
    Thanks,
    Abdi

  • I have set up my work Exchange email/calendar. After setting up I am getting passcode expired message and asking for changing the passcode with a 16   digit and 4 special characters. No combination of numberic, alphanumeric, special characters works. Help

    I have set up my work Exchange email/calendar. After setting up I am getting passcode expired message and asking for changing the passcode with a 16 +  digit and 4 special characters. No combination of numberic, alphanumeric, special characters is working. Help!!

    I have set up my work Exchange email/calendar. After setting up I am getting passcode expired message and asking for changing the passcode with a 16 +  digit and 4 special characters. No combination of numberic, alphanumeric, special characters is working. Help!!

  • Need help in replacing special characters in a string

    Hi,
    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    with regards.
    sumanth.

    please let me know the best way to replace all the special characters in a string with space.
    other than alphabets and numbers
    >
    Sumanth Nag Kristam wrote:
    > actually i need to replace hexa decimal char 0X1A in a string.... that is 'substitue' as per the chart
    > any pointers....
    >
    > chk the link for the ASCII codes
    > http://www.techonthenet.com/ascii/chart.php
    But in Hexa decimal value there is no special characters?

Maybe you are looking for