regex wildcards ^ in sql database

Proposed Answer regex wildcards ^ in sql database

  • Wednesday, March 06, 2013 7:20 PM
     
     
    I have built a database that uses regular expression, my question is the database is growing very fast and I cannot keep up with the records. I therefore want to use a wildcard for some columns. I have tried '^maxfile_' to read all files with maxfile_ in the begining. But they don't work. sample of my files are maxfile_[0-9]{8},maxfile_A_[0-9]{8}, maxfile [0-9]{8} and maxfile.

All Replies

  • Wednesday, March 06, 2013 11:12 PM
     
     Proposed Answer

    The support for regular expressions in SQL Server is poor.

    To read all rows that start with "maxfile_", you can do:

       SELECT ... FROM tbl WHERE col LIKE 'maxfile[_]%'


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    • Proposed As Answer by Eshani Rao Wednesday, March 06, 2013 11:35 PM
    •  
  • Thursday, March 07, 2013 5:37 PM
     
     

    Please look at the attach database columns are you saying I should set my columns like below

  • Thursday, March 07, 2013 10:52 PM
     
     

    Well, to be honest, I have very little understanding of what you are trying to achieve. There are no regular expression in SQL Server, but maybe you are using some CLR function?

    It would certainly help if you could explain the full plot for what you are doing.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
  • Monday, March 11, 2013 1:50 PM
     
     
    Yes I am using CLR function? functions any help
  • Monday, March 11, 2013 2:44 PM
     
     

    I have found this tool http://www.ultrapico.com/Expresso.htm useful for bench testing regular expressions.

    David


    David http://blogs.msdn.com/b/dbrowne/