How can I write a query to siolate the value after the decimal point

This query
 
select 
spraddr_pidm,
SPRADDR_CITY
 from spraddr 
where 
 SPRADDR_NATN_CODE = 'CA'
and SPRADDR_ATYP_CODE = 'AH'
Returns the following output (just an example I like 1,000 records that I need to fix)
140804     Toronto, Ontario
140832     Quebec, Quebec
140845     Halifax, NS
140889     Mississauga, Ontario
140902     Boucherville, Quebec
140945     Westmount, Quebec
136971     Montreal, Quebec
180650     Granby, Quebec
137007     Quispamsis, NB
137037     Varennes, Quebec
180746     Port Williams, NS
As you can see that providence is inserted into the column city (SPRADDR_CITY)

I want to break the column and isolated from providence, so I can insert into a custom table
the city and providence, so I can fix the files...
I guess the question is how do I write a query to isolate the providence...
Thank you

Hello

Here's one way:

WITH     got_comma_pos     AS
(
     SELECT     spraddr_pidm
     ,     spraddr_city
     ,     INSTR ( spraddr_city || ','
                , ','
                )          AS comma_pos
     FROM     spraddr
     WHERE     spraddr_natn_code     = 'CA'
     AND     spraddr_atyp_code     = 'AH'
)
SELECT  spraddr_pidm
,     SUBSTR (spraddr_city, 1, comma_pos - 1)          AS city
,     LTRIM (SUBSTR (spraddr_city, 1 + comma_pos))     AS province
FROM      got_comma_pos
;

What do you do if there is no comma in spraddr_city? The above query assumes that the entire string is the name of the city in this case and the province with a NULL value.

You can also use regular expressions, but this way is more effective and about as simple to code.

Tags: Database

Similar Questions

  • How can I write a digital waveform to the digital output (traditional DAQ)

    Hello

    I use a NI 6023e, PCI, with 8 digital outputs. I generated a digital waveform. How can I write for a specific digital production line now?

    I only have Labview 7, so I can't use DAQmx.

    Thank you very much


  • How can you write a time interval in the timer for User Interface?

    Use a timer on a control panel, that triggers a callback function to the sample data.  I would like to read a digital input from the user interface panel and then set this value in the interval of the timer.  But how do you write the interval of timer?  Obvious function doesn't seem to work,

    SetCtrlVal (panelHandle, PANEL_TIMER, %SAMPLESECONDS%);

    Probably the best place to start is with the help of high level for the control that you are interested in.   I usually just to go to the index tab in help, start typing the name of the control (timer in this case) and then choose the top level help topic.  From here, you can see the attributes that you can use the events you can capture, programming concepts, etc.

    NickB

    National Instruments

  • How can I return my screen to its default values after you run the Windows 7 color calibration?

    I decided to run the color calibration tool windows to try to optimize my monitor, but the quality came out worse than before. After trying several times and otherwise, to get a better picture I decided that I would just back to its default value. The problem is that I don't see an option for it. So, how can I reset my screen its initial values of before I tried calibration it?

    Thank you

    Using Windows 7 Pro 64-bit

    Windows (rstrui.exe) system restore would do it without data loss.

  • How can I write action script 3 in the script window?

    Hello

    I am not able to write any code to ActionScript 3 editor. The following error occurs. Help, please.

    No selected action.

    The snapshot of the error is attached.

    Kind regards.ActionScript Error.JPG

    Stop() should be stop(), without capital letters.

    For your first assignment, it seems you were in script assist mode, where I think you need to use forms and controls to enter code (select a control and click on the + sign, etc.).  If you turn off you should be able to manually enter your own code.

  • How can I write a script to set the maximum pixel dimensions?

    I need lots of JPGs and limit the maximum size of 500 px. This must apply to the largest side of the image, either in height or width. The other side should auto size proportionally. I currently have to make these changes to size manually. I have not found any scripting language or function which will allow me to set the size of larger pixel to 500 px, no matter what size is the most important.

    Example:

    1. If the image is 1000 w x 750 px: px, I want the script to resize the image proportionally to the largest side, change the width to 500 px

    2. If the image is 750 px x 1000 px h w, I want the script to change the height to 500 px and proportions are consistent for the width

    All ideas are welcome grately.

    Thank you

    Linda

    Create an action that use file - automate - Fit Image.

    I think that there may always be a bug that this should fix...

    Mage http://www.PS-scripts.com/BB/viewtopic.php?f=10&t=3370&p=15152&Hilit=Don%27t+Enlarge+fit+i & sid = ea73e8349aaf965015a4a351340e865d #p15152

  • How can I write the value of floats Unitronics vision230 PLC with modbus Ethernet

    How can I write the value of type Float in unitronics PLC Vision230 modbus ethernet (Ethernet Master Query.vi MB) usinsg I read and write register 32 bits, for example, I want to write the value 23.45 2nd Add. MF. And registry MF is the 32-bit registry. I read and write register 32-bit.

    Narendra.

    Narendra,

    Two characters can type cast into a uint16 you VI supports.

    To summarize. Take one (4 bytes). Flatten it to a string (4-byte) divided this string into two parts of 2 bytes each. Cast in u16 (16 x 2 = 32-bit).

    However, if you really want to follow the IEEE standards then you will need refer this KB. His is not that simple, but seems closer to what you are looking for.

    Amit

  • How can I get a query in the search field to open in a new tab or a new window, and the current window?

    How can I get a query in the search field to open in a new tab or a new window, and the current window?

    If you are looking through the search bar in the Navigation toolbar, this preference can be changed to research it open in a tab.

    Type of topic: config in the address bar and press ENTER. Then answer "I'll be careful." Type this pref in the search at the top.

    Browser.Search.openintab = double click to switch to true

  • How can I write a DVD blu - ray on a mac?

    How can I write a DVD blu - ray on a mac? I tried a blu - ray burner and (if necessary) the software to use.

    I found the BE14NU40, BD playback/BD write LG, but I don't know if it's Mac compatible.

    Can anyone advice a good burner + software?

    I used one of them for several years and it works very well with Mac:

    ta-drive-solution-blu-ray-6x-dl-dvd-r-rw https://www.MacFixIt.com.au/OWC-mercury-Pro-super-multi-blue-Blu-ray-external-SA...

    Al

  • How can I write a letter in french with Pages

    I use my computer in English, and I have to write an essay in french

    So, how can I write a letter in french with Pages

    Hi Luke,.

    If you are familiar with the French keyboard layout, you can move from the keyboard to this provision.

    If not, you can acess of the accents you will need the English KB layouts using (for example) option-~, then press e to e, or -e option, then press e to e. see the viewer keyboard for other options. Open the keyboard Viewer, and then press option key to display the keys to use for each accent.

    If all the accents you need are not available from an English keyboard, you can still list a French KB language as a 'second choice' and switch to it when you need an accented letter.

    Choice of the keyboard are defined in system preferences > language and text > input sources. If you choose more KB a page layout, the entry menu (a flag) will appear in your menu bar. The indicator shows the currently active KB.

    Kind regards

    Barry

  • Satellite Pro M30: How can I write on a CD 900 MB?

    Hello
    How can I write on a CD 900 MB, I use nero 7 and nero on what they told me I have to update my firmware CD writer questioned. I got satalite pro M30 and windows XP SP2.

    Hello

    I found this firmware on the Toshiba driver page:
    http://support.toshiba-tro.de/Tools/updates/DVD-r-RW-firmware/SD-rxxxx/frmwre-na.zip

    But I m not 100% sure if it works.
    You can also try to search the FW on the driver page.
    http://EU.computers.Toshiba-Europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp?service=EU

  • How can I write my results to Excel in a perticular line sheet?

    Hi all

    I'm new in labview and I have a problem.

    I found my results, it is in the 2D array... He sometimes in 1 d array because I want to remove the header line.

    How can I write my results one by one in the row following on it?

    Hereby, I have attached the excel sheet where I write my results.

    There are about 25 result so I have to run my VI 25 times but the result appears in excel sheet in 25 succeeding row.

    hope you find my question...

    Thank you

    Ok..

    I'll probably do...

  • If I have floating values such as 6.3 6.7, 6.9, 7.1, 7.2, how can I write a case statement to handle this

    How can I write a case statement if I want a case for x< 1.5;  ="" a="" case="" for="" 1.5=""><= x=""><= 3.7; ="" case="" for ="" 3.7="">< x="">< 7.2.....etc.  ="" my="" input="" is="" a="" floating="">

    Thank you.

    You don't seem to have set rules on inclusion, but I often use the function in the range and Coerce in these cases.

  • How can I write in a table cell (row, column appear) in a databae?

    How can I write in a table cell (row, column appear) in a database using LabVIEW Database Toolkit? I use Ms Access. Suppose I have three columns in a table, I write 1 row of the 1st column, then 1st rank of the 3rd column. The problem I have is after writing the 1st column of 1st row, the reference goes to the second row, and if I write in the 3rd column, he goes to the 2nd row 3rd column. Any suggestion?

    When you perform a SQL INSERT command, you create a new line. If you want to change an existing line, you must use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column = some_value). The some_column could be the unique ID of each line, date and time, etc.

    I don't know what is the function to use in the Toolbox to execute a SQL command, since I do not use the Toolbox. Also, I don't understand why you don't do a single INSERT. It would be much faster.

  • How can I write a whole byte to a port of digital I/o on a NI7340

    I was able to find a Port.flx of e/s from reading that allows me to read all 8 bits at a time. I can't find a Port.flx VI e/s writing. How can I write all 8 bits at a time?

    Take a look at the value of MOMO.flx of I/o Port. Here is general information about DIO with Motion and here an explanation on the Protocol of MOMO (should we need to Off).

Maybe you are looking for