Home > Archive > MS SQL Server MSEQ > August 2005 > Query Help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Query Help
Steve1445

2005-07-31, 8:24 pm

Here is what I am trying to do.

I need to query a table like this:

SELECT PROPERTYTYPE, INDUSTRY, ORGNAME
FROM ORGANIZATION
WHERE (INDUSTRY LIKE '51%')
ORDER BY INDUSTRY

I provide the variable, in this case a range of numbers from the Industry
column starting with 51. This returns three columns of data, which two out
of three are populated. The field propertytype is most likely empty. If it is
empty I want the query to fill all the empty spots with another number I
provide. If its not empty, then I want to leave it alone.
priya.H.Gupta@lntinfotech.com

2005-08-01, 3:25 am

If i am not wrong your query will look like this

SELECT isnull( PROPERTYTYPE,'X'), INDUSTRY, ORGNAME
FROM ORGANIZATION
WHERE (INDUSTRY LIKE '51%')
ORDER BY INDUSTRY

'X' - number provided by you

"Steve1445" ने लिखा:

> Here is what I am trying to do.
>
> I need to query a table like this:
>
> SELECT PROPERTYTYPE, INDUSTRY, ORGNAME
> FROM ORGANIZATION
> WHERE (INDUSTRY LIKE '51%')
> ORDER BY INDUSTRY
>
> I provide the variable, in this case a range of numbers from the Industry
> column starting with 51. This returns three columns of data, which two out
> of three are populated. The field propertytype is most likely empty. If it is
> empty I want the query to fill all the empty spots with another number I
> provide. If its not empty, then I want to leave it alone.

Steve1445

2005-08-01, 9:23 am

close, but you got me on the right track, here is what I came up with using
yours as the base:

UPDATE ORGANIZATION
SET PROPERTYTYPE = '45321'
WHERE (INDUSTRY LIKE '5112') AND (PROPERTYTYPE IS NULL)

Thanks!

"priya.H.Gupta@lntinfotech.com" wrote:
[color=darkred]
> If i am not wrong your query will look like this
>
> SELECT isnull( PROPERTYTYPE,'X'), INDUSTRY, ORGNAME
> FROM ORGANIZATION
> WHERE (INDUSTRY LIKE '51%')
> ORDER BY INDUSTRY
>
> 'X' - number provided by you
>
> "Steve1445" ने लिखा:
>
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com