Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Monday, March 26, 2012

outer join oracle query translate in sql server

Hi,
I have this oracle query with outer join situation. how can i convert it into sql server query.

SELECT distinct ae.dB_CONTRACT,CP.PC_CODE,BID_ITEM.ITEM_NO,
'N',BID_ITEM.PRICE_WORDS,OFF_ITEM.DESCPT,
OFF_ITEM.UNITS,OFF_ITEM.TYPE_ITEM,
PRES_ITEM.RET_PERC
FROM BID_TOTAL,BID_ITEM,OFF_ITEM,PRES_ITEM, AE_CONTRACT AE, CONTRACT_PC CP
WHERE RANK_NUMB = 1
AND BID_TOTAL.DB_CONTRACT = 37044
AND BID_TOTAL.DB_CONTRACT = BID_ITEM.DB_CONTRACT
AND BID_TOTAL.BID_VENDOR = BID_ITEM.BID_VENDOR
AND BID_ITEM.DB_CONTRACT = OFF_ITEM.DB_CONTRACT
AND BID_ITEM.ITEM_NO = OFF_ITEM.ITEM_NO
AND OFF_ITEM.ITEM_NO = PRES_ITEM.ITEM_NO (+)
AND AE.DB_CONTRACT=BID_TOTAL.DB_cONTRACT
AND CP.DB_CONTRACT = AE.DB_CONTRACT
AND CP.pc_code = 1

Any Help will be appreciated.I thhink this is it

SELECT DISTINCT
ae.dB_CONTRACT
, CP.PC_CODE
, BID_ITEM.ITEM_NO
, 'N'
, BID_ITEM.PRICE_WORDS
, OFF_ITEM.DESCPT
, OFF_ITEM.UNITS
, OFF_ITEM.TYPE_ITEM
, PRES_ITEM.RET_PERC
FROM BID_TOTAL
JOIN BID_ITEM
ON BID_TOTAL.DB_CONTRACT = BID_ITEM.DB_CONTRACT
AND BID_TOTAL.BID_VENDOR = BID_ITEM.BID_VENDOR
JOIN OFF_ITEM
ON BID_ITEM.ITEM_NO = OFF_ITEM.ITEM_NO
AND BID_ITEM.DB_CONTRACT = OFF_ITEM.DB_CONTRACT
LEFT JOIN PRES_ITEM
ON OFF_ITEM.ITEM_NO = PRES_ITEM.ITEM_NO
JOIN AE_CONTRACT AE
ON AE.DB_CONTRACT = BID_TOTAL.DB_cONTRACT
JOIN CONTRACT_PC CP
ON CP.DB_CONTRACT = AE.DB_CONTRACT
WHERE RANK_NUMB = 1
AND BID_TOTAL.DB_CONTRACT = 37044
AND CP.pc_code = 1

Test it out...|||Hi,
thank you very much..it worked excellent

Originally posted by Brett Kaiser
I thhink this is it

SELECT DISTINCT
ae.dB_CONTRACT
, CP.PC_CODE
, BID_ITEM.ITEM_NO
, 'N'
, BID_ITEM.PRICE_WORDS
, OFF_ITEM.DESCPT
, OFF_ITEM.UNITS
, OFF_ITEM.TYPE_ITEM
, PRES_ITEM.RET_PERC
FROM BID_TOTAL
JOIN BID_ITEM
ON BID_TOTAL.DB_CONTRACT = BID_ITEM.DB_CONTRACT
AND BID_TOTAL.BID_VENDOR = BID_ITEM.BID_VENDOR
JOIN OFF_ITEM
ON BID_ITEM.ITEM_NO = OFF_ITEM.ITEM_NO
AND BID_ITEM.DB_CONTRACT = OFF_ITEM.DB_CONTRACT
LEFT JOIN PRES_ITEM
ON OFF_ITEM.ITEM_NO = PRES_ITEM.ITEM_NO
JOIN AE_CONTRACT AE
ON AE.DB_CONTRACT = BID_TOTAL.DB_cONTRACT
JOIN CONTRACT_PC CP
ON CP.DB_CONTRACT = AE.DB_CONTRACT
WHERE RANK_NUMB = 1
AND BID_TOTAL.DB_CONTRACT = 37044
AND CP.pc_code = 1

Test it out...|||if your oracle install is 9i
the ansi join syntax actually works
after 20 years!!!!!

Monday, March 12, 2012

osql utility

Hi all
I am using osql utility in sql server 2000 to convert data in database to excel sheet. My datas contain both english and chinese . While converting to excel sheet english datas are comming but the datas in chinese is comming like (?) this. Does any body has any idea to solve this problem. is there any way to set font in osql utility.

set @.x = 'osql -S servername -U username -P password -q "select * from

northwind..region" -w 3000 -s "," -o C:\Download\download.csv'
This is what i have used.
Note: I tried giving chinese font in excel still it is not working.
Its really urgent pls reply
thanksHave you tried using the -u parameter of OSQL.EXE to force Unicode output? That would be needed for Chinese characters.

-PatP|||What version of Excel are u using Have u turned on Multilingual

Friday, March 9, 2012

osql question!

I have a question regarding SQL Server 7.0. I know I am living in primitive
age but we are looking forward to convert to 2005 soon!
My problem is kind of weird (at least to me). I have these sets of nested
stored procedures which I use to do some heavy computation on the database
server. I extract data from the SP as the result. I have made a batch job
using which I can run the stored procedures via osql utility.
My problem is that when I run the stored procedure using osql (batch file)
it takes forever to run, but when I run the same from Query Analyzer it gets
done fairly fast (15 mins approx). I am dealing with quite a bit of data
here (like 50,000 rows and 20 different tables). But, it seems like the
problem is not within my stored procedures.
Do I need to worry about anything else while running query/sp from osql as
opposed to running them from Sql Query Analyzer?
I will appreciate any response.
NibenCheck out http://support.microsoft.com/default.aspx?scid=kb;en-us;816834.
You might also try including SET NOCOUNT ON if you haven't already done so.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Niben" <Niben@.discussions.microsoft.com> wrote in message
news:E0729BBF-876B-43EE-BB60-D46729F1BD7A@.microsoft.com...
>I have a question regarding SQL Server 7.0. I know I am living in primitive
> age but we are looking forward to convert to 2005 soon!
> My problem is kind of weird (at least to me). I have these sets of nested
> stored procedures which I use to do some heavy computation on the database
> server. I extract data from the SP as the result. I have made a batch job
> using which I can run the stored procedures via osql utility.
> My problem is that when I run the stored procedure using osql (batch file)
> it takes forever to run, but when I run the same from Query Analyzer it
> gets
> done fairly fast (15 mins approx). I am dealing with quite a bit of data
> here (like 50,000 rows and 20 different tables). But, it seems like the
> problem is not within my stored procedures.
> Do I need to worry about anything else while running query/sp from osql as
> opposed to running them from Sql Query Analyzer?
> I will appreciate any response.
> Niben|||Thanks Dan!
So seems like there's no solution for sql 7.0 huh! Any patches as they have
for SQL 2000.
"Dan Guzman" wrote:
> Check out http://support.microsoft.com/default.aspx?scid=kb;en-us;816834.
> You might also try including SET NOCOUNT ON if you haven't already done so.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Niben" <Niben@.discussions.microsoft.com> wrote in message
> news:E0729BBF-876B-43EE-BB60-D46729F1BD7A@.microsoft.com...
> >I have a question regarding SQL Server 7.0. I know I am living in primitive
> > age but we are looking forward to convert to 2005 soon!
> >
> > My problem is kind of weird (at least to me). I have these sets of nested
> > stored procedures which I use to do some heavy computation on the database
> > server. I extract data from the SP as the result. I have made a batch job
> > using which I can run the stored procedures via osql utility.
> >
> > My problem is that when I run the stored procedure using osql (batch file)
> > it takes forever to run, but when I run the same from Query Analyzer it
> > gets
> > done fairly fast (15 mins approx). I am dealing with quite a bit of data
> > here (like 50,000 rows and 20 different tables). But, it seems like the
> > problem is not within my stored procedures.
> >
> > Do I need to worry about anything else while running query/sp from osql as
> > opposed to running them from Sql Query Analyzer?
> >
> > I will appreciate any response.
> >
> > Niben
>
>

osql question!

I have a question regarding SQL Server 7.0. I know I am living in primitive
age but we are looking forward to convert to 2005 soon!
My problem is kind of weird (at least to me). I have these sets of nested
stored procedures which I use to do some heavy computation on the database
server. I extract data from the SP as the result. I have made a batch job
using which I can run the stored procedures via osql utility.
My problem is that when I run the stored procedure using osql (batch file)
it takes forever to run, but when I run the same from Query Analyzer it gets
done fairly fast (15 mins approx). I am dealing with quite a bit of data
here (like 50,000 rows and 20 different tables). But, it seems like the
problem is not within my stored procedures.
Do I need to worry about anything else while running query/sp from osql as
opposed to running them from Sql Query Analyzer?
I will appreciate any response.
Niben
Check out http://support.microsoft.com/default...;en-us;816834.
You might also try including SET NOCOUNT ON if you haven't already done so.
Hope this helps.
Dan Guzman
SQL Server MVP
"Niben" <Niben@.discussions.microsoft.com> wrote in message
news:E0729BBF-876B-43EE-BB60-D46729F1BD7A@.microsoft.com...
>I have a question regarding SQL Server 7.0. I know I am living in primitive
> age but we are looking forward to convert to 2005 soon!
> My problem is kind of weird (at least to me). I have these sets of nested
> stored procedures which I use to do some heavy computation on the database
> server. I extract data from the SP as the result. I have made a batch job
> using which I can run the stored procedures via osql utility.
> My problem is that when I run the stored procedure using osql (batch file)
> it takes forever to run, but when I run the same from Query Analyzer it
> gets
> done fairly fast (15 mins approx). I am dealing with quite a bit of data
> here (like 50,000 rows and 20 different tables). But, it seems like the
> problem is not within my stored procedures.
> Do I need to worry about anything else while running query/sp from osql as
> opposed to running them from Sql Query Analyzer?
> I will appreciate any response.
> Niben
|||Thanks Dan!
So seems like there's no solution for sql 7.0 huh! Any patches as they have
for SQL 2000.
"Dan Guzman" wrote:

> Check out http://support.microsoft.com/default...;en-us;816834.
> You might also try including SET NOCOUNT ON if you haven't already done so.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Niben" <Niben@.discussions.microsoft.com> wrote in message
> news:E0729BBF-876B-43EE-BB60-D46729F1BD7A@.microsoft.com...
>
>

osql question!

I have a question regarding SQL Server 7.0. I know I am living in primitive
age but we are looking forward to convert to 2005 soon!
My problem is kind of weird (at least to me). I have these sets of nested
stored procedures which I use to do some heavy computation on the database
server. I extract data from the SP as the result. I have made a batch job
using which I can run the stored procedures via osql utility.
My problem is that when I run the stored procedure using osql (batch file)
it takes forever to run, but when I run the same from Query Analyzer it gets
done fairly fast (15 mins approx). I am dealing with quite a bit of data
here (like 50,000 rows and 20 different tables). But, it seems like the
problem is not within my stored procedures.
Do I need to worry about anything else while running query/sp from osql as
opposed to running them from Sql Query Analyzer?
I will appreciate any response.
NibenCheck out http://support.microsoft.com/defaul...b;en-us;816834.
You might also try including SET NOCOUNT ON if you haven't already done so.
Hope this helps.
Dan Guzman
SQL Server MVP
"Niben" <Niben@.discussions.microsoft.com> wrote in message
news:E0729BBF-876B-43EE-BB60-D46729F1BD7A@.microsoft.com...
>I have a question regarding SQL Server 7.0. I know I am living in primitive
> age but we are looking forward to convert to 2005 soon!
> My problem is kind of weird (at least to me). I have these sets of nested
> stored procedures which I use to do some heavy computation on the database
> server. I extract data from the SP as the result. I have made a batch job
> using which I can run the stored procedures via osql utility.
> My problem is that when I run the stored procedure using osql (batch file)
> it takes forever to run, but when I run the same from Query Analyzer it
> gets
> done fairly fast (15 mins approx). I am dealing with quite a bit of data
> here (like 50,000 rows and 20 different tables). But, it seems like the
> problem is not within my stored procedures.
> Do I need to worry about anything else while running query/sp from osql as
> opposed to running them from Sql Query Analyzer?
> I will appreciate any response.
> Niben|||Thanks Dan!
So seems like there's no solution for sql 7.0 huh! Any patches as they have
for SQL 2000.
"Dan Guzman" wrote:

> Check out http://support.microsoft.com/defaul...b;en-us;816834.
> You might also try including SET NOCOUNT ON if you haven't already done so
.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Niben" <Niben@.discussions.microsoft.com> wrote in message
> news:E0729BBF-876B-43EE-BB60-D46729F1BD7A@.microsoft.com...
>
>