SQL help string search

Hi,

Is there any easy way to search a column to see if it contains either a dash 
or alpha character ?

Thanks ! 


0
Robbie
9/12/2010 11:46:54 AM
sqlserver.programming 1873 articles. 0 followers. Follow

1 Replies
1440 Views

Similar Articles

[PageSpeed] 52

On Sun, 12 Sep 2010 07:46:54 -0400, Robbie wrote:

>Hi,
>
>Is there any easy way to search a column to see if it contains either a dash 
>or alpha character ?
>
>Thanks ! 
>

Hi Robbie,

SELECT KeyColumn, SearchColumn
FROM   TheTable
WHERE  UPPER(SearchColumn) LIKE '%[A-Z-]%';

If your database uses a case insensitive collation, you can leave out
the UPPER function call.

-- 
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
0
Hugo
9/12/2010 12:22:32 PM
Reply:

Similar Artilces:

help with problem formula
this formula worked up to yesterday. i had a power surg and now it onl give me one color. Private Sub LCase(Target.Val Target As Range) Dim myColor As Long If Target.Cells.Count > 1 Then Exit Sub If Intersect ( Target, Me.Range("d:d")) Is Nothing Then Exit Sub Select Case LCase(Target.Value) Case Is = "a" : myColor = 33 Case Is = "b" : myColor = 38 Case Is = "c" : myColor = 20 Case Is = "e" : myColor = 35 Case Is = "f" : myColor = 40 Case Is = "g" : myColor = 8 Case Else myColor =x1None End selection Target.Interior.Col...

Please help #7
I have 2 front-end servers (OWA 2003 servers) and 3 backend servers (Exchange 2003 clustering). -- users have no problem login to Outlook 2003 to access email. -- users using OWA 2003, after keyin the user id & password on the pop-up credential windows. It shows an error page below, this happened even using internal LAN workstations. Thus, nothing to do with firewall. -- the last thing i did was upgraded all Windows 2003 servers to SP1 and all Exchange 2003 to SP1. Pls HELP..... The page cannot be displayed........... ........................................ HTTP 500 - Internal serv...

Help me in Iraq with Outlook on a USB pen-drive
Hello all, I'm in Iraq dealing with a lot of information sent via e- mail, and I have to remain mobile. I have a 1.5 gb USB mini-hard drive and I was hoping to configure Outlook 2002 (as I have my Office 2002 CD that I brought with me) on it and hot swap it from computer to computer as needed accessing my POP account. The problem is that I can't seem to get Outlook installed entirely on the USB Drive... it always seems to install a part onto the C: drive rendering it useless on another computer (and not very stable on this computer which has the full office xp suite on it....

Query Help : accounts which are not members of existing marketing list
Hey all, I have few marketing lists and having lot of accounts as members . Now i am interested to make a new marketing list with new members , which are not member of any of existing marketing list. Is there any way to see which accounts are not member of existing marketing list ? Thanks Aami Sure AAmi, Not within CRM but you can run this in the SQL Query Analyzer to find them: select * from accountbase A left join ListMemberBase L on A.accountid = L.entityID where L.entityID is null HTH, Dave Aami wrote: > Hey all, > > I have few marketing lists and having lot of accounts...

help with the syntax for using range name in a formula?
I have --------=3D+AVERAGE(SMALL(B7:B19,{1,2,3}))-------------. I want to replace B7:B19 with =93Myrange=94 but I can=92t seem to get the syntax right. excel says error in formula. Thks in advance for any help BRC Hi =AVERAGE(SMALL(Myrange,{1,2,3})) have you created Myrange? have you spelt it correctly? -- Regards Roger Govier "BRC" <brc1051-googrps@yahoo.com> wrote in message news:d0e09817-22dc-4c36-b60d-67a397067441@h9g2000yqa.googlegroups.com... > I have --------=+AVERAGE(SMALL(B7:B19,{1,2,3}))-------------. I want > to replace B7:B19 with �Myra...

HELP! I can't go to my desktop, much less get online
I kept losing my connection on my WiFi laptop, so I tried repairing the connection by right clicking the icon. Now when I start my pc it presents me with a place to type a password-and I never have set a password to get into my computer. How do I avoid this because it is my computer and I'd like to use it. My system is Windows XP, IE8.-Thank nYou for your help, I'm typing this on someone elses computer. James Moore Larry wrote: > I kept losing my connection on my WiFi laptop, so I tried repairing > the connection by right clicking the icon. Now when I start my pc it ...

Help with vlookup #3
using 2003. I am looking up a number (stored as a string) on another worksheet and returning another series of numbers (also stored as a string) - ie lookup return 411140 263791-411140E Problem - Excel formats the returned data as: 2.63791E+11. It apparently sees it as a mathmatical subtraction of an exponential number even tho it is a text. It doesn't seem to matter how I format the cell. When I format it as text, the formula does not work. (requires General to execute formula). Executing a "text to columns" does the same thing. I need the returned data to show - 263...

Exchange 2000
Hello, Does anybody know of search tool that can perform the following: 1. Search the Mailbox store directly, i.e., M: 2. We are interesting in search for From, To, Subject and Body and if possible attachment contents. 3. We would like to do one pass on the information store so we wish to be able to build a multiople search query, i.e., a) Search for "John" b) Search for person@domain.com c) Search for "HELLO" d) etc... 4. We would like to then be able to copy our findings to a folder or something.... It seems that the built in searchin...

need help working in publisher 07
when i open a blank document it looks very squatty...the measurements are bigger across the top of the page and narrower along the sides of the page, even tho both are in inches. Do you mean your page is landscape instead of portrait? -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "rebecca" <rebecca@discussions.microsoft.com> wrote in message news:D569716A-8BBE-4FBF-89B6-5DD7E519E1D3@microsoft.com... > when i open a blank document it looks very squatty...the measurements are > bigger across the top of ...

Allen Browne Client Search Multiple Like Statements
Hi all, I need to have this code search multiple fields, but I keep getting "Expected end of statement" on the Me in the second to last line: If Not IsNull(Me.txtFilterMainName) Then 'strWhere = strWhere & "([MainName] Like ""*" & Me.txtFilterMainName & "*"") AND " strWhere = strWhere & "([Address1] Like ""*" & Me.txtFilterMainName & "*"") OR " & _ strWhere = strWhere & " ([StreetName] Like "" * " & Me.txtFilterM...

Need help with IF function
I need help writing an IF expression: IF("reference cell is empty", leave blank, otherwise statement) than -- Message posted from http://www.ExcelForum.com =IF(A1="","",Statement -- Message posted from http://www.ExcelForum.com =if(Cell Number="","",Statement) rmo5354 wrote: > *I need help writing an IF expression: > IF("reference cell is empty", leave blank, otherwise statement) > > thanx -- Message posted from http://www.ExcelForum.com To indicate a cell is empty, simply use quotes with nothing in between t...

SQL Optimized Integration
We are implementing Dynamics GP and would like to use the SQL Optimized Integration option (instead of the Standard 'macro' Integration). The problem I am having is that we pass in 'discount' items in our orders by using negative Unit Price values. When I run the integration, I get an error message: DOC 1 ERROR: Unit price cannot be less than zero. Is there any way to modify the rules in the SQL Optimized Integration to allow negative Unit Price values? Thanks. try using negative quantities instead HS "Corwin" <Corwin@discussions.microsoft.com> wrote ...

Design advice SQL or QueryDef
I've built a form to dynamically create SQL statements. My original idea was to save the SQL Statements into a table ("tblCustomSQL") as a string. (Table has 2 fields, "Name", and "SQL".) I'm using an "INSERT" SQL statement to add records to tblCustomSQL. I'm running into trouble with nested quotation marks. If the custom SQL statement is formatted correctly, the quotations in the custom SQL interfere with the INSERT statement. I've tried encoding the SQL statement with markers (QUOTE - in place the multiple quotations), but de...

How do we let our SQL app 'relay' through Ex2003 SO2?
We have an app on a server 10.0.1.15 that uses Exchange to send out mail. Sometimes the mail is filtered out by the IMF and we find it in the UCE Archive. We want the mail from this IP to go through regardless. What's the best way to do this? Thanks, Neal exchange system manager. servers. your server name protocols SMTP Defaults SMTP Virtual Server properties access relay only the list below and add the IP address -- Nawar Aljanabi MCSE NT/2000/2003,MCSA 2003 +M,CCNA "Neal" wrote: > We have an app on a server 10.0.1.15 that uses Exchange to send out mail. > ...

Help with Calculation #2
Hi, I have the following XLS with 3 sheets: Credits, Inventory & Debits. Credits sheet (Stock sold) columns: 'Product Code', 'Product' (Text field) & 'Quantity' Inventory fields: 'Product' (Text field), 'Company', 'Supplier', 'Product Code', 'Quantity', 'Cost Price' & 'Retail Price'. Debits Sheet (Stock bought) columns: 'Product Code', 'Product' (Text field), 'Quantity' & 'Total cost'. New stock entered as 'Product Code', 'Product', 'Quantity&#...

Returning Partial Strings
I'm trying to separate a word/string of characters in a text field from the rest of the field, but the strings are of varying lengths. Is there a way to extract this? For example, my field contains the following values: RAST 2006-1 M5 CWALT 2006-AR1 A How can I extract the "RAST" and the "CWALT" from each? How can I extract the "2006-1" and the "2006-AR1" from each? Thanks in advance! On Thu, 31 Jan 2008 14:44:02 -0800, ScottM wrote: > I'm trying to separate a word/string of characters in a text field from the > rest of the field,...

Generic Type parameters and Strings .. confused !
Could someone please clarify a small point of confusion for me please. MSDN excerp ... When applying the where T : class constraint, avoid the == and != operators on the type parameter because these operators will test for reference identity only, not for value equality. This is the case even if these operators are overloaded in a type that is used as an argument. The following code illustrates this point; the output is false even though the String class overloads the == operator. public static void OpTest<T>(T s, T t) where T : class { System.Console.WriteLine(...

help with If functoin
Hello!. I am a teacher and I have column formed of Roll nos from 1 to 250 of my students. I mark their presence in B column by marking p . I want to asertain in column C if the a particular cell B2 contains p or not. How do I proceed with If funcion? because when I use the following formula =if B1='p',1,0. then error is turned up saying #name? Please help. Also How do I calculate individual student's total presence ? Thank. -- hirendra7158 ------------------------------------------------------------------------ hirendra7158's Profile: http://www.excelforum.com/member.php?a...

Inserting a string of text in front of existing text in excel
How do I insert a word or words in front of existing text cells on a multiple cell basis ? Hi try something like the following macro (works on your selection): sub foo() dim rng as range dim cell as range dim str_part set rng=selection str_part="precede_" for each cell in rng if cell.value<>"" then cell.value=str_part & cell.value end if next end sub >-----Original Message----- >How do I insert a word or words in front of existing text >cells on a multiple cell basis ? >. > If a formula will do, try something like this (with the existing text...

Need Formula Help....
Hi: Is there a formula string for something like this.....?: I want a number in a cell when a specific word is typed in another cell, for example, if I wanted the number 50 to appear in C2 if I type the word, say, Airplane, in cell C1? Thanks, pinger You need to define what you want when cell C1 does not contain the word airplane. Enter this formula in C2: =IF(C1="airplane",50,"") If C1 does not contain airplane the formula will leave the cell blank. -- Biff Microsoft Excel MVP "pinger" <pinger@ec.rr.com> wrote in message news:47cf6287$0...

help to compare two list
I have a file with all the open orders for production and I have another file with orders which is already sent to production. I want to find out from the first list, which orders are not send for production. Thanks. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Take a look at http://cpearson.com/excel/duplicat.htm In article <itty.vneun@excelforum-nospam.com>, itty <itty.vneun@excelforum-nospam.com> wrote: > I have a file with all the open or...

interest/inflation formula help
Could someone please do this formula for me. �300,000 to work out its worth each year (including interest) Then deduct cost of living % (inflation) each year. So �300,000 (at 6% interest) = �318000 deduct (inflation at say 3%)= �308460 (this would be its net worth say after one year I would use rows A1 to J10 for the actual amounts and would use 2 cells in row 2 for the interest rate and for the inflation figure, this way I could change the rates without altering the formula. I hope this makes sense. thanks There are a heap of financial functions built into excel. Look up PV ...

Some macro help
Lets say I have selected the arbitray range of j31:ax44. I want to run some macro code that will hide every column in that selection where the entire selected column range has nothing in it (blank). Data validation may be assigned to the cells, but if nothing has been selected from the drop down list, then those cells are technically blank. There may be data entered elsewhere in the column, but it is outside of the selected range and thus shouldn't be considered for being hidden or not. Can anyone help me with some code to perform this action? TIA, AlanN How about: Option Explicit Sub...

Help! Exchange 5.5 logon failure
Hi all, We recently upgraded our NT domain to Windows Server 2003 Active Directory (Native Mode). While in the process of upgrading our Exchange 5.5 / SP4 server (running on NT4/SP6) to Exchange Server 2003 (Enterprise Edition, running on Windows Server 2003), we noticed that our users can no longer logon to the server using either: - Outlook Web Access - Microsoft Outlook clients (XP or 2003) Please note that if we supply the credentials of the Exchange 5.5 Service account during authentication (on the pop-up dialog box), the logon process succeeds! In addition, POP3/SMTP clients (e.g. Outlo...

Problems and Problems. Eperts please help
We are running GPS version 9.5 . I think its not supported by support any more so I amnot sure anyone can help me with this. We were running this of a Novell File server. It had Novell 5.0, GPS directory and Pervasive sql 2000i our server crashed. I build a new server and installed novell/ Perasvive sql 2000 and all the clients on the clients machine. Copied the GPS directory and made sure the clients path were pointing correctly to the GPS path. Now every client gets an error. Run betrieve first Nothing has changed the configration is the same and I have installed the betrieve clien...