Bringing back results that match a certain character type

Hi, thank you for any help.
Below is a few values from a field in a database table. I like to bring back the values that only have ###-####. I do not want to bring back any other values that has any other kind of characters in them unless its a number. Thank you
I want to bring back only         
105-1110          
105-1114          
105-1121          
105-1125          
105-1298          
105-1300  
I dont want to bring back the ones below.
001-10            
001-2-13          
002-2-10          
003-43            
003-52            
003-87           
0820-FR           
1-0-17            
1-0-18            
1-0-19            
1-0-20            
1-0-22            
1-0-29            
1000-SW           
1030-SW                 
105-CIFM          
Edwin Lopera

One option
declare @table table(val varchar(10));
insert into @table
values
('105-1110'),
('105-1114'),
('105-1121'),
('105-1125'),
('105-1298'),
('105-1300'),
('001-10'),
('001-2-13'),
('002-2-10'),
('003-43'),
('003-52'),
('003-87'),
('0820-FR'),
('1-0-17'),
('1-0-18'),
('1-0-19'),
('1-0-20'),
('1-0-22'),
('1-0-29'),
('1000-SW'),
('1030-SW'),
('105-CIFM')
select * from @table
where val like '[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
Satheesh
My Blog |
How to ask questions in technical forum

Similar Messages

  • How to skipp or enable all the stpes that belong to certain step type in A sequence file?

    I have a big sequence file, and I have a very special requirement:that is to skipp or enable all the stpes that belong to certain step type?
    I know it could be a somewhat chanllenge, but I believe it can be done.
    Thanks!
    Jacky

    Hi Jacky,
    http://forums.ni.com/ni/board/message?board.id=330​&message.id=2419&query.id=86917#M2419
    http://forums.ni.com/ni/board/message?board.id=330​&message.id=1610&query.id=86919#M1610
    Here are a couple of examples that Get or Set the Run Mode of a step.
    There are also examples on the NI website for TestStand, that will obatin all the steps of a sequence / sequence file,
    http://sine.ni.com/apps/we/niepd_web_display.displ​ay_epd4?p_guid=B45EACE3EE5556A4E034080020E74861&p_​...
    http://sine.ni.com/apps/we/niepd_web_display.displ​ay_epd4?p_guid=EF3B073A7D7B5336E0340003BA7CCD71&p_​...
     which should help for building the basic loop to get a step,
    check its Step Type (there is an example of this on website),
    http://sine.ni.com/apps/we/niepd_web_display.displ​ay_epd4?p_guid=BB88802AAEA621D5E034080020E74861&p_​...
    to decide whether to modify the Step property or not.
    The tricky bit is whether your sequence call steps call sequences in the sequence file or in an external sequence file.
    Hope this gets you started.
    What version of TestStand are you using?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • A php search engine that only shows results that match entire serch string

    I have set up a dreamweaver search engine through php and a fulltext search (WHERE MATCH (....) AGAINST (...). However, when someone inputs more than one word into the search form, the search engine churns out results that only have one of those words. How do I get it to only show results that have all the search string words inside? (or, at least, how do I get those results to show up at the top?)
    I have seen some advice (here) that uses php code to process the search query, divide up the words, and place a BOOLEAN '+' between each of the words. By doing this, the search engine will only show results that fully match all the terms.
    My problem is that I do not know how to put this code into my Dreamweaver-created code.
    My dreamweaver created code:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $form_rsSearch = "-1";
    if (isset($_get['search'])) {
      $form_rsSearch = $_get['search'];
    mysql_select_db($database_dataConnect, $dataConnect);
    $query_rsSearch = sprintf("SELECT title, content FROM encyclopedia WHERE MATCH (title, content) AGAINST (%s)", GetSQLValueString($form_rsSearch, "text"));
    $rsSearch = mysql_query($query_rsSearch, $dataConnect) or die(mysql_error());
    $row_rsSearch = mysql_fetch_assoc($rsSearch);
    $totalRows_rsSearch = mysql_num_rows($rsSearch);
    $input_rsSearchResults = "-1";
    if (isset($_GET['search'])) {
      $input_rsSearchResults = $_GET['search'];
    mysql_select_db($database_EMdataConnect, $dataConnect);
    $query_rsSearchResults = sprintf("SELECT title, content FROM encyclopedia WHERE MATCH(title, content) AGAINST(%s)", GetSQLValueString($input_rsSearchResults, "text"));
    $rsSearchResults = mysql_query($query_rsSearchResults, $dataConnect) or die(mysql_error());
    $row_rsSearchResults = mysql_fetch_assoc($rsSearchResults);
    ?>
    and the code the website (link above) gives is:
    function search(String $search_string) {
         //strip Boolean search characters out of search string
         $search_string = string_replace($search_string,"+","");
         $search_string = string_replace($search_string,"-","");
         $search_string = string_replace($search_string,"*","");
         //split the search string up into an array of words
         Array $tokenized_search = split($search_string, " ");
         //init an empty final search string
         String $processed_search = "";
         //for each word in the search, wrap it
         //with an + and * character and then append
         //it to the processed_search variable
         foreach($tokenized_search as $token) {
              $processed_search+="+"+$token+"* ";
         //build the sql for the query and query the DB
         String $db_query = "select id, description
              from product_descriptions
              where MATCH(description)
              AGAINST ('"+$processed_search+"' IN BOOLEAN MODE)";
         Array results = execute_database_query($db_query);
         return results;
    If anyone can instruct me on the correct way to go about this, I would be very much obliged.
    Thank you,
    YWSW

    Don't use the Search bar, type the address in the Location bar.

  • Extracting rows that match a certain criterion

    Hi guys,
    I realize that spreadsheet software has certain limitations, but I was hoping I could stretch it a tad bit, by asking if it's possible to take rows that meet a certain criterion and have them listed in another table.
    I've included an example wherein I take a list of a few well-known crypto characters and extract those that are not checked as evil (i.e., evil is FALSE) into a different list.
    http://pyth.net/hotlinking/cast-salaries.png
    I'd appreciate any suggestions; and thanks in advance for any time taken to respond.
    Regards,
    Friðrik Már

    We have posted a solution but now I have to find it. You can test for the "TRUE" / "FALSE" nature of the check box then show related row/column information using VLOOKUP, and IF statements. You could then filter for the presence of a value.
    =IF(A2=TRUE,VLOOKUP(...
    Regards,

  • Sending PDF with a certain character type

    Hi all,
    1. After getting the print parameters with the function u2018GET_PRINT_PARAMETERS'
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
    DESTINATION = 'N006'
    *LINE_SIZE = 080
    line_count     = 65
    IMMEDIATELY = ' '
    NO_DIALOG = 'X'
    IMPORTING
    OUT_PARAMETERS = PARAMS
    VALID = VALID.
    2. NEW-PAGE PRINT ON PARAMETERS PARAMS NO DIALOG NO-TITLE NO-HEADING.
    3. Make a PDF for a certain spool with the function 'CONVERT_ABAPSPOOLJOB_2_PDF'
    4. And at last sending the pdf with  thefunction SO_DOCUMENT_SEND_API1'
    The users receive wel the pdf, but they want another character type (bigger one) , how can I build this ?
    Thanks

    No solution

  • False returns - search brings back images that are not tagged

    If I search on, for example, "Bag", I get all the images that I have tagged with "Bag", but then get a whole load more that do not have that word in their keywords (not even as part of another word) - where is the search engine finding the word "Bag"? I have had this with some other words too... Any ideas?

    The search has many options, some loose some tight. Seems like if you have "contains" and "all criteria met" it should exclude all images that are not tagged "bag". If you have "any criteria met" then you could get other files, but still seems like "bag" would have to be in there someplace.

  • Detect a certain character and return it's index in the string

    what's the function that detects a certain character e.g."X" in a string line and returns its index then continues to detect the next 'X" in the same line. do i also need to store them in an array?

    You have to write one. Also, please stop starting new threads on this topic. This is all related to the same problem you're having, and posting so many threads makes it tough on everyone who wants to help you. It's rude, and wasteful of other people's time; namely, the folks that are actually trying to help you solve your problem.

  • How to convert strings into character type?

    I have created a function module which will display the attributes of the fields of the structure/table by using "DESCRIBE FIELD" command. The problem is that it supports only character-type data objects and the program goes into dump
    if the structure contain any string type.

    Please have a look at class CL_ABAP_DATADESCR. Using this instances of this class should provide all information needed...
    Reward points, if reply is applicable

  • Bring back the Filter option in Search results

    Well, not only Sorting is messed up (removed) from the latest realease of Spotify, filtering is as well. You can no longer filter (ctrl-F/cmd-F) your search results, and, as with many other great features killed without explanation, we want this one back as well. Thanks!
    PS. You can manually bring back the old search - including sorting and filter options - if you write "spotify:search:[search term]" in the search field.

    Is there a business reason why this feature hasn't returned, despite a huge number of complaints?  (Matt Suda - does he work for Spotify? - writes in this thread that it is coming back but its status is still "Watch this space" in the monthly ideas review).   I can think of a few business model reasons that Spotify doesn't want its customers to have filter/search.  For example: 1- I bet it's reduced the amount of use by customers like me, so the business gets the "Health Club" revenue stream - loads of subscribers who don't use the service much.  2-  Perhaps its a way of increasing use of the Facebook aspect of Spotify and so creating more advertising revenue.   If we are wasting our time and effort asking for the return of this feature then please, Spotify, just tell us and we will vote with our wallets after examining the competition.

  • Google search does not work. It does not bring back any results and disables my internet connection until I close the brower, wait, and then open it again.

    Google search does not work. It does not bring back any results and disables my internet connection. I have to close the browser, wait, and then open it again. It only seems to happen when I am signed into my Google account. If I am signed out the search functions properly.

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx - Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • How to create custom search box will allow up to 60 alphanumericcharacters & User can input a minimum of 1 character and the system will pull back an exact match on the sequence entered.

    Hi,
    Can anyone please help me in creating the Custom Search box with below mentioned functionality
    "The search box will allow up to 60 alphanumeric characters.User can input a minimum of 1 character and the system will pull back an exact match on the sequence entered"

    Hi Pradeep,
    Find the complete JQuery AutoComplete function with along with different events in it like focus, select, open and close. You can modify this code as per your requirement.
    $("#ddlSearchTextBox").autocomplete({
    source: function (request, response) {
    var getUrl = "<site URL>";
    $.ajax({
    url: getUrl,
    type: "GET",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    data: {
    featureClass: "P",
    style: "full",
    maxRows: 10
    dataFilter: function (data, type) {
    return data.replace(/\\'/g, "'");
    success: function (data) {
    response($.map(data.d, function (result) {
    return {
    label: result.Last_Name + ", " + result.First_Name,
    value: result.id
    focus: function (event, ui) {
    $("#ddlSearchTextBox").val(ui.item.label);
    return false;
    minLength: 1,
    select: function (event, ui) {
    $("#ddlSearchTextBox").val(ui.item.label);
    return false;
    open: function () {
    $("#ddlSearchTextBox").removeClass("ui-corner-all").addClass("ui-corner-top");
    close: function () {
    $("#ddlSearchTextBox").removeClass("ui-corner-top").addClass("ui-corner-all");
    Let us know if you need any further.
    Thanks, Shakir | Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Hello I'd like to know how to walk redo my iMessage on my ipod touch 4th . I connect and then says to choose an email address and it says Check and this is the me that his brings back on the menu. So please help me

    Hello I'd like to know how to walk redo my iMessage on my ipod touch 4th . I connect and then says to choose an email address and it says < Check> and this is the me that his brings back on the menu. So please help me!

    You can try
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    However, some other users have reported that did not work. No real solution has been posted here yet

  • I I have a late 2005 power PC G5 that I want to bring back to life.  I need to replace the original hard drive, a Maxtor 250 GB Sata.  Can I replace it with modern drives, SATA 5-6 etc?

    I have a late 2005 power PC G5 that I want to bring back to life.  I need to replace the original hard drive, a Maxtor 250 GB Sata.  Can I replace it with modern drives, SATA 5-6 etc?

    I knew I should never get rid of my old G5's.  By the way, there is a browser still supported for the PPC, TenFourFox, if you're not using it already.  Go to the Floodgap website (they author it)  download it for free.  The only thing it doesn't support is the Flash plugin, but the browser works great. Other video types are supported.  It's based on Firefox, and runs most of the plugins and add-ons. It's very fast, and beats all other browsers on the browser compatibility and speed test.  That's now my default on my G5's.  Firefox and Safari are no longer supported.  As far as the OS, both Tiger and Leopard were solid for me.  The reason, as I stated before, was iMovie.  The version in Tiger with iLife was far superior to what Apple changed it to.  They 'dumbed it down' for the masses.  Even the newest iLife 11 on my Mac Pro quad isn't is good, in my opinion.  So Leopard should be fine for you.  It's a much larger browser in terms of sheer megabytes and disk space, but it's fine.  As far as getting an OS disc, I'm seeing Tiger for about $45.00, Leopard for $50 - 60.00 on that famous auction site.  As far as RAM, I have 8GB in my G5 2.3, but you should check Activity Monitor when you are running your apps.  See how much green slice you have left (unused RAM).  You might find you don't need eight.  A Mac Pro will grab more free RAM than a PPC machine will.  I have a hard time maxing out use of my 8 on the PPC.  Not true with the eight on my Mac Pro.  The OS doesn't hesitate to grab and use it.  You might be OK with 6GB on your PPC. More will not make you faster, as long as you still have free RAM available.  As far as backup on your resurrected machine:  look for a firewire enabled backup if can.  Use CCC (Carbon Copy Cloner) and make a clone backup.  Next time your PPC machine wipes out the hard drive, just take your Firewire drive and plug it into another PPC machine, and you can select it as your boot drive. You'll be back and running in five minutes.  You can also take the physical drive out of your enclosure, and put it in your tower to replace the failed drive, and you'll be back to where you were in less than ten minutes, OS and all.  The PowerMac has an 800 port, so you can do the 800 on the machine to an 800 port on your backup. A firewire 800 to 800 cable is only about $8.00.  It runs nice and fast through the 800 port.  I like the OWC Mercury Extreme enclosures.  They use USB, Firewire 800, and eSATA, so all your options are open.

  • Whenever i click on word or powerpoint it always brings up a recent document. I want to have the option like when i had first opened the app that gives the options of new document and the variety of different documents. how do i get it back to that?

    whenever i click on word or powerpoint it always brings up a recent document. I want to have the option like when i had first opened the app that gives the options of new document and the variety of different documents. how do i get it back to that?

    tbreezy wrote:
    THANK U!! K ONE MORE QUICK QUESTION. HOW DO I GET RID OF THAT POP UP BOX?
    Not sure, try googling "the global template normal.dotm is already open as an add-in program"

  • Bring back the YouTube app that is not in ios6

    Bring back the YouTube app that is not in ios6

    If you look in your Safari bookmarks, you may find there is one for Utube. This folder just magically appeared there with the upgrade.to iOS6 on my iPhone.

Maybe you are looking for