> I am wondering - can P9 be used to write reports against a MS SQL
> Server database?
Yes, I do it all the time. You just need to create an ODBC DSN to the MS
SQL Server database and enable Auto ODBC in the BDE, then the DSN will
appear to Paradox as a BDE Alias. You can open, query, and run passthre
SQL against the SQL Server tables, and include the tables in Reports.
Best to run passthru SQL against remote tables and base the report on an
Answer table.
Also note that Paradox cannot recognize Unicode types (ntext, nvarchar,
nchar, etc), so if those types are used on your SQL Server database, you
will have to translate them. You can either do this on the fly with
Passthru SQL or base your queries, etc on SQL Server views. In either
case, re-project any unicode types as the same name, but with the
CONVERT() function. (I think that's the function).
--
Larry DiGiovanni
Digico, Inc
IT Consulting and Staffing Solutions
www.digicoinc.com
Check out www.thedbcommunity.com for Paradox resources
I opened up the bde configuration utility and selected the SQL Server, but I
don't see anything called "autoodbc". What should I be looking for?
"Larry DiGiovanni" <nospam@nospam> wrote in message news:415316a6_3@cnews...
> Yes, I do it all the time. You just need to create an ODBC DSN to the MS
> SQL Server database and enable Auto ODBC in the BDE, then the DSN will
> appear to Paradox as a BDE Alias. You can open, query, and run passthre
> SQL against the SQL Server tables, and include the tables in Reports.
>
OK - I believe that I have an odbc connection established in my control
panel/admin tools/odbc admin. (I'm running XP). In the O... Admin panel I
created something under the User DSN tab that uses the SQL Server driver. I
also created something under the System DSN tab that uses a SQL Server
driver.
Neither of the names associated with these two "odbc connections"(?) shows
up in my list of aliases when I open P9. I did go into the BDE Config.
manager and both of these names show up there, and I noted that the name of
the .CFG file that I am seeing is the one I open my pdox session up with (I
even added the -o switch to make sure). What am I missing?
If that doesn't do it, try creating the DSN as a System DSN.
Tried to build a query in the old fashioned pdox way but that didn't work
("capability not supported"). So now I'm in the Visual Query Builder and I
clicked on the two dropdowns in the menu bar to selecte my alias and a table
within that alias on my sql server. A panel shows up in the Query Builder
window showing field names from the table - but not very many of them. Only
a couple of date/time fields and a couple of dollar amounts that are typed
(apparently) as "float". Where are my char. fields that comprise most of
the data? I actually selected a couple of these fields and let her run and
it came back with results, but without the char fields that describe the
records, this isn't much good. Is this the conversion problem you first
mentioned? how do I correct this part now?
Thanks in advance!!!!
"Larry DiGiovanni" <nospam@nospam> wrote in message news:415325db_1@cnews...
AutoODBC =TRUE works well when you have just a few ODBC drivers, and no
mandatory ODBC DSNs installed for all users in an organization.
In short, I have found too many cases with AutoODBC=TRUE and also Options =
Virtual, so I know don't use it anymore.
Typical errors:
Could not write to engine configuration file (Paradox alias manager - not
BDE Admin)
Unknown table type (Saving or running a QBE based on remote table)
--
Bertil Isberg - CTECH
Paradox buglist:
online: http://w1.826.comhem.se/~u82608896/
FAQ newsgroup: corel.wpoffice.paradox-faq
> Tried to build a query in the old fashioned pdox way but that
> didn't work ("capability not supported").
Do you have Unicode columns in the tables? You can only see this using a
native SQL Server tool, like QueryAnalyzer. If that's the case, refer
back to my original posting for a workaround.
> So now I'm in the Visual Query Builder and I
I've never used the VQB, so I can't help much there.
> Is this the conversion problem you first mentioned?
I suspect it is.
> how do I correct this part now?
You'll have to project affected columns in your SQL Server tables using
the T-SQL function CONVERT()
Example,
mytable:
Reckey I (PK)
Descr nvarchar(30)
If what you want is:
SELECT Reckey, Descr
FROM mytable
You'd write it as:
SELECT Reckey, CONVERT(varchar, Descr) AS Descr
FROM mytable
You can still do comparisons, etc on the unaltered column:
SELECT Reckey, CONVERT(varchar, Descr) AS Descr
WHERE Descr = 'foo'
I.e., you don't have to CONVERT columns for comparisons (so long as you
ensure the query runs remotely).
This can get a little ponderous and isn't helpful if you want to QBE, or
bind forms or reports, so a workaround is to have someone (the DBA) create
VIEWS of all of the tables you want to get at that employ the CONVERT()
function as above:
CREATE VIEW mytable_v AS
SELECT Reckey, CONVERT(varchar, Descr) AS Descr
FROM mytable
Then you can work directly with mytable_v as you would a Paradox table,
more or less.
Note that I may have gotten the syntax on CONVERT wrong. Check BOL to be
sure.
The workaround, Jim, is to create a new Alias, choose the type as the ODBC
Driver, and specify the DSN.
I had some 30 drivers under Drivers - ODBC. When I removed them, I got rid
of the errors. But as soon as AutoODBC is set to TRUE, the ODBC drivers
reoccur. I rather believe it's the number of drivers than the number of
aliases.
I have spent a couple of days at my office to find the explanation and
solutions for those errors.
I just may make headway today!
"Larry DiGiovanni" <nospam@nospam> wrote in message
news:41532db7$1_2@cnews...
SELECT cast(dbo_pbfdtl.proj as char(6))
FROM ":SQL_PBF:dbo.PBFDTL" dbo_PBFDTL
Now the query was originally built by the Query Expert - I just chopped it
down to the bare minimum for testing this out. When I attempt to run it
the error I get from this is:
(from paradox)
"Type mismatch in expression"
Now - I've played with the syntax enough to believe that I don't have a
syntax error, since I get to the login box before I get the error message.
When my syntax was incorrect (such as when I was trying to use "convert"
instead of cast) I didn't get that far along when I hit F8. So - I have to
think it's something to do wiht the data conversion. The SQL table has the
field "proj" stored as "nchar". I'm trying to convert it to a paradox alpha
field, but "alpha" is not accepted syntactically - "char" is though.
Anybody have an idea as to what my error is and how to correct this? I'm
really excited to think that I can still use paradox to generate reports off
my new database, so I really want to clear this hurdle.
FROM ":SQL_PBF:dbo.PBFDTL" dbo_PBFDTL
>>
By supplying the alias in the SQL statement, the SQL will run locally,
and Paradox cannot handle nchar(). You have to run it remotely by
removing the alias, and instead selecting the Alias :SQL_PBF: in the
alias control on the toolbar. When you do, note that the Title of the
SQL Editor now will say :SQL_PBF; instead of :WORK:
SELECT cast(proj as char(6)) as Proj
FROM dbo.PBFDTL
The last as Proj is to give the column a better name in Paradox.
--
Bertil Isberg
CTECH
FAQ newsgroup: corel.wpoffice.paradox-faq
Paradox Buglist: http://w1.826.comhem.se/~u82608896/
remove spamfilter (reversed) to reply
I thought when I checked the properties of the query, under the SQL table,
and selected the "run query remotely" option, that I WAS running the query
remotely. This does not work that way?
"Bertil Isberg" <bertil...@retlifmapsSCB.se> wrote in message
news:41541ac7$1_3@cnews...
I removed the "dbo." from the FROM clause and it ran. So - where does that
'dbo' come from and what's it mean?
"Bertil Isberg" <bertil...@retlifmapsSCB.se> wrote in message
news:41541ac7$1_3@cnews...
>
The statement should be
SELECT cast(proj as char(6)) as Proj
FROM dbo.PBFDTL
when run at the server. IMO the dbo should be there. It's the owner of
the table.
<<
I thought when I checked the properties of the query, under the SQL
table, and selected the "run query remotely" option, that I WAS running
the query remotely. This does not work that way?
>>
If you write the SQL in a correct way, it will work. It won't remove the
Paradox specific notation like an alias.
Thanks for the push in the right direction- at least I can now get to my sql
server data. Now onwards to more complex queries.
"Bertil Isberg" <bertil...@retlifmapsSCB.se> wrote in message
news:41542335_2@cnews...
> Well, it works ONLY when I remove the "dbo.", so I guess I won't
> tamper with that.
Post the SQL that worked and the SQL that didn't work. Are you connecting
to the database as the database owner or dba/sa?
Could this be caused by the ODBC setting Quoted Identifiers?
I'm a very happy man today. Thanks all!!!
"Bertil Isberg" <bertil.isberg@NOcomhemSPAMdotse> wrote in message
news:41543ac4$1_2@cnews...
> Could this be caused by the ODBC setting Quoted Identifiers?
That's why I wanted to see working/nonworking code. Some of the snippets
he'd posted made me wonder about the generated SQL.
But since Jim is now a very happy man, our work here is done. <g>