Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Friday, March 23, 2012

Outer join for two tables

Hi guys,

Please Help!

I am using Excel's VBA in order to retrieve sql Data.

I have three tables of the "my Company" DataBase (sql server 2000):

Table1, Table2, Table3

I need to join:

Table1.FieldXX=Table2.FieldYY

Table1.FieldWW= Table3.FieldZZ

In both cases, I should retrieve all data from Table1, even if Table2 or Table3 don't have the correspondent entries.

I am trying to use the code below, but getting "sql syntax error":

FROM myCompany.dbo.Table1 Table1

LEFT OUTER JOIN myCompany.dbo.Table2 Table2 ON (Table1.FieldXX=Table2.FieldYY)

AND

LEFT OUTER JOIN myCompany.dbo.Table3 Table3 ON (Table1.FieldWW= Table3.FieldZZ)

I will appreciatte any help.

Thanks in advance,

Aldo.Hi Guys,

This is the code working properly:

FROM myCompany.dbo.Table1 Table1

LEFT OUTER JOIN myCompany.dbo.Table2 Table2 ON Table1.FieldXX= Table2 .FieldYY

LEFT OUTER JOIN myCompany.dbo.Table3 Table3 ON Table1.FieldWW= Table3.FieldZZ

Aldo.sql

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

osql utility

using osql utility i have converted a table in database to excel format. I have also chinese data in my database . The problem is while converting the data into excel format ,the chinese data is not comming in excel sheet.
Does anybody have an idea about this .
For converting i have used

declare @.x varchar(300)
set @.x = 'osql -S Servername -U username -P passwd -q "select * from northwind..region order by cand_index" -w 3000 -s "," -o C:\directory\filename.csv'

ThanksDid you try using BCP instead and may be try using 950 codepage as a one of the switches . eg. -C950

something like

bcp "Select * from Northwind.dbo.region" queryout "D:\temp\filename.csv" -c -T -C950

Use other switches to specify field seperator -t etc

let know how it goes

...|||I would add a -u parameter to your OSQL command.

-PatP