Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Tuesday, March 20, 2012

Re-raising error

In a stored procedure I usually check @.@.ERROR after every
INSERT/UPDATE/DELETE. If any error, then I exit SP with this error
code. A client application does not receive much information
with this code, so it displays a message like "Cannot insert/update record.
Error : NNN".
Is there a way to get more detailed information about an error?
RAISERROR only throws user-defined errors. Any ideas?"Tumurbaatar S." <spam_tumur@.magicnet.mn> wrote in message
news:u6%23Wmxd8FHA.3132@.TK2MSFTNGP12.phx.gbl...
> In a stored procedure I usually check @.@.ERROR after every
> INSERT/UPDATE/DELETE. If any error, then I exit SP with this error
> code. A client application does not receive much information
> with this code, so it displays a message like "Cannot insert/update
> record. Error : NNN".
> Is there a way to get more detailed information about an error?
> RAISERROR only throws user-defined errors. Any ideas?
>
Unless you use TSQL TRY/CATCH the client will recieve both the original
error and the stored procedure return code. Different client libraries
interpret this data differently, but most have a way to grab the error.
David|||Is your client application SQLServer or something else (dotnet, java etc)?
If SQL then @.@.error is fine unless you want to catch the specific error from
sysmessages. I only ever use raiserror(@.text,1,1) for triggers and i don't
use triggers so I don't really use it.
If it is an external App and you are not a GOTOless programmer then try
something like below then just call the entries from the log table in the
external App:
If @.@.ERROR <> 0 or @.@.ROWCOUNT <= 0
begin
select @.text = 'Error -50: Could not update TableAdata for w.'
select @.result = -50
GOTO ERROR_POINT
end
ERROR_POINT:
PRINT 'ERROR_POINT'
GOTO FINISH
FINISH:
select @.resultText = 'RoutineName: ' + @.text + ' from User ' + @.pWho + ' at
' + convert(varchar(15),getdate(),3) + ' ' + convert(varchar(15),getdate(),1
4)
INSERT INTO log VALUES (@.resultText, 'RoutineName', getdate(), 'Y')
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET NOCOUNT OFF
GO|||No pun intended, but please explain how this one works.
There must be something missing from the sample you posted.
All statements will be executed - even if there is no error and the rowcount
is above 0, and in such a case a null value (or an unexpected one) will be
inserted into the log.
Do you actually use this in your production code?
ML|||Thank you!
But you are both talking about SQL2005? If I'm not mistaken,
SQL2000 does not support TRY/CATCH exception handling. And that
is only reason why I asked for how to re-raise (read "rethrow") an error.
If there was try/catch handling in SQL2000, I had no problem.|||"Tumurbaatar S." <spam_tumur@.magicnet.mn> wrote in message
news:%235tAGhh8FHA.3984@.TK2MSFTNGP11.phx.gbl...
> Thank you!
> But you are both talking about SQL2005? If I'm not mistaken,
> SQL2000 does not support TRY/CATCH exception handling. And that
> is only reason why I asked for how to re-raise (read "rethrow") an error.
> If there was try/catch handling in SQL2000, I had no problem.
>
IN SQL 2000 there is no way to prevent the error message from propagating to
the client. If the client is using, for instance, .NET the calling code
will get a SqlException. Only in SQL 2005 is there a way to stop the error
from going to the client (CATCH), and so only there is there any need to
"rethrow" the error in SQL Server.
David|||> IN SQL 2000 there is no way to prevent the error message from propagating
> to the client. If the client is using, for instance, .NET the calling
> code will get a SqlException.
But how does a client receive an error? For example, a SP executes
INSERT that fails due to some constraint violation:
INSERT ...
IF @.@.ERROR <> 0
...
What happens in this case? SP execution stops before IF @.@.ERROR,
exits with an error notification and the client engine receives a standard
SQL error. Or SQL server remembers this error, the SP continues processing
and when SP exits normally (i.e. RETURN @.some_value) the client engine
receives
this return code (@.some_value), but also it receives the previously saved
error too?|||"Tumurbaatar S." <spam_tumur@.magicnet.mn> wrote in message
news:e2m$$tq8FHA.472@.TK2MSFTNGP15.phx.gbl...
> But how does a client receive an error? For example, a SP executes
> INSERT that fails due to some constraint violation:
> INSERT ...
> IF @.@.ERROR <> 0
> ...
> What happens in this case? SP execution stops before IF @.@.ERROR,
> exits with an error notification and the client engine receives a standard
> SQL error. Or SQL server remembers this error, the SP continues processing
> and when SP exits normally (i.e. RETURN @.some_value) the client engine
> receives
> this return code (@.some_value), but also it receives the previously saved
> error too?
Sort of, yes. The client gets the return code and any errors which occured.
Most client libraries don't expose both through the API, however. If an
error occurs, you will likely not get a return code from the procedure.
David|||Many thanks!
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e$Zbolw8FHA.740@.TK2MSFTNGP11.phx.gbl...
> "Tumurbaatar S." <spam_tumur@.magicnet.mn> wrote in message
> news:e2m$$tq8FHA.472@.TK2MSFTNGP15.phx.gbl...
> Sort of, yes. The client gets the return code and any errors which
> occured. Most client libraries don't expose both through the API, however.
> If an error occurs, you will likely not get a return code from the
> procedure.
> David
>
>

requirements to connect to a named instance of MSDE 2.0

What is the propery syntax to establish a connection with a named instance
of MSDE on a server from a client workstation using the SQL Query analyzer
(or EM for that matter)?
I have tried "myServer\myInstance" to no positive effect.
Could I do this via TCP from a remote PC? What would be the syntax for
that?
Thanks.
Hi
"myServer\myInstance, portnumber"
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"astro" <astro@.bcmn.com> wrote in message
news:VorVd.24398$Sq5.7292@.twister.rdc-kc.rr.com...
> What is the propery syntax to establish a connection with a named instance
> of MSDE on a server from a client workstation using the SQL Query analyzer
> (or EM for that matter)?
> I have tried "myServer\myInstance" to no positive effect.
> Could I do this via TCP from a remote PC? What would be the syntax for
> that?
> Thanks.
>
>

requirements to connect to a named instance of MSDE 2.0

What is the propery syntax to establish a connection with a named instance
of MSDE on a server from a client workstation using the SQL Query analyzer
(or EM for that matter)?
I have tried "myServer\myInstance" to no positive effect.
Could I do this via TCP from a remote PC? What would be the syntax for
that?
Thanks.Hi
"myServer\myInstance, portnumber"
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"astro" <astro@.bcmn.com> wrote in message
news:VorVd.24398$Sq5.7292@.twister.rdc-kc.rr.com...
> What is the propery syntax to establish a connection with a named instance
> of MSDE on a server from a client workstation using the SQL Query analyzer
> (or EM for that matter)?
> I have tried "myServer\myInstance" to no positive effect.
> Could I do this via TCP from a remote PC? What would be the syntax for
> that?
> Thanks.
>
>

Friday, March 9, 2012

Req: how to deploy a SQL Client Alias to multiple clients

Hi there,
I'm looking for a quick way to setup/deploy an SQL alias on multiple
clients?
Due to an hw upgrade, we are moving our cluster to a new server, and we need
to setup on multiple clients a new SQL Client Alias and an ODBC System DSN.
I found that Sql Client Alias configuration are stored in a registry key,
but I don't know if exporting the hive from the first client and importing
in the remaining other will be ok
Thanks in advance
---
Silvio Accomando
Torre Informatica Srl
---Use regedit to expot the registry key and then use regedit to apply it to
the client.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Wednesday, March 7, 2012

Reposting: How to extract (and email) only 1 client's data from th

Hi,
My vb.net app will use msde for database needs. The app is a tool in which the app user (companyA) will do some planning for their clients. So basically, the database will have information about all the clients (Sam, Julia, Peter, Nancy etc) of our cust
omer (companyA). Now suppose there is some error happening in the application for user Nancy, and we want the companyA to send us only Nancy's data so that we can duplicate the error and debug it. How do we do that...
In previous versions of our app where we used the flat files for data storage, we will just tell the companyA to email us Nancy.ourFile so that we can have a look at the data which is causing the problem. How to extract only Nancy's data from the whole d
atabase...
Thanks
dev
hi,
"dev_kh" <devkh@.discussions.microsoft.com> ha scritto nel messaggio
news:782E4169-30DB-4AEF-B7BC-CC375DABE132@.microsoft.com...
> Hi,
> My vb.net app will use msde for database needs. The app is a tool in
which the app user
>(companyA) will do some planning for their clients. So basically, the
database will have
>information about all the clients (Sam, Julia, Peter, Nancy etc) of our
customer (companyA).
> Now suppose there is some error happening in the application for user
Nancy, and we want
> the companyA to send us only Nancy's data so that we can duplicate the
error and debug it.
> How do we do that...
> In previous versions of our app where we used the flat files for data
storage, we will just tell the
> companyA to email us Nancy.ourFile so that we can have a look at the data
which is causing
>the problem. How to extract only Nancy's data from the whole database...
> Thanks
> dev
>
it depends how you can identify Nancys' data...
if it's a complete database, than detach it, zip it and mail it...
if data is shared with other user's data, than you have to filter on perhaps
owner.tableName.col_User = 'Nancy' and export it to a flat file, probably
using BCP, something like
c:\>BCP "SELECT * FROM [db_name].[owner].[table/view name] WHERE colUser =
'Nancy'" queryout c:\NacyData_objName.txt -c -S(local) -T
make a batch file with all the queryout BCP commands...
or provide a DTS to be executed locally to equally export to file
those file will be then BCP in on testing server for toubleshouting...
good idea? =;-)
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

reposting: bkup and resore strategy. Please reply

Hi,
My vb.net app will use database which will be deployed using MSDE on client
machines. I will provide UI to client in my app to backup and restore the d
atabase. My app will work with one database, for e.g. MyAppDB. My question
is what are the best pract
ices for doing this:
a) Should I choose Full or Simple mode. There is no mission critical data.
But as my clients will be using MSDE, will setting up the recovery mode as
Full cause the database and log size limits to cross the 2GB limit soon. Is
it better if I choose SIMP
LE recovery mode. What do you suggest.
b) Should I back up the system databases also, if yes then what should be th
e order of backing these up (and then in what order should the databases be
restored)
c) Does the MSDE login information also needs to be backed up. At max I wil
l have just one custom login and sa. I am using SQL Authentication.
d) Will I need to close my application and make sure that my apps' MSDE inst
ance is not running before backing up the databases.
d) I want to provide user the option to choose the backup location. How wil
l I figure out if they chose something like tape drive or zip drive. How sh
ould I handle this scenario.
e) Also how can I find out if there is sufficient space on the hard drive to
backup the database. Are there any standard sql functions to check that.
f) Should I do database log file backup too while backing up the database.
sorry for so many questions.
thanks
newbie
Print | Copy URL of this post
Expand All Collapse AllSee answers inline:
"newbie" <anonymous@.discussions.microsoft.com> wrote in message
news:3DFC5E47-73A3-4CFC-9161-0AF13E789AD5@.microsoft.com...
> Hi,
> My vb.net app will use database which will be deployed using MSDE on
client machines. I will provide UI to client in my app to backup and
restore the database. My app will work with one database, for e.g. MyAppDB.
My question is what are the best practices for doing this:
> a) Should I choose Full or Simple mode. There is no mission critical
data. But as my clients will be using MSDE, will setting up the recovery
mode as Full cause the database and log size limits to cross the 2GB limit
soon. Is it better if I choose SIMPLE recovery mode. What do you suggest.
I almost always use either full or bulk-logged, although there are a few
instances where simple is appropriate. Basically you need to determine in
the event of failure do you want to be able to recover to the point of
failure, or is it good engoug to recover from the last full backup? As for
size limits, you can control the size of the log by backing it up regularly.
Besides, I am pretty sure that the 2Gb size limit is on the data file, not
the log.

> b) Should I back up the system databases also, if yes then what should be
the order of backing these up (and then in what order should the databases
be restored)
Yes, at least master and msdb, but the order of backing them up is not
important. Master would be the first to be restored

> c) Does the MSDE login information also needs to be backed up. At max I
will have just one custom login and sa. I am using SQL Authentication.
The logins are stored in master.

> d) Will I need to close my application and make sure that my apps' MSDE
instance is not running before backing up the databases.
No, backups are an online operation.

> d) I want to provide user the option to choose the backup location. How
will I figure out if they chose something like tape drive or zip drive. How
should I handle this scenario.
That's an application issue, you stated that you were providing them a front
end UI to backup the databases. The destination of the backup files is just
one of the BACKUP command arguments. There are also several arguments that
apply only to tape backup operations that you might want to take into
consideration.

> e) Also how can I find out if there is sufficient space on the hard drive
to backup the database. Are there any standard sql functions to check that.
There isn't a function that will estimate the size of the backup, but you
can read the msdb..backupset table to get the size of the last backup (or an
average of the last several) and estimate the size based on that.

> f) Should I do database log file backup too while backing up the database.
Not at the same time, although it won't hurt anything, there's just no
reason to do them at the same time.

> sorry for so many questions.
> thanks
> newbie
>
> Print | Copy URL of this post
>
> Expand All Collapse All
>|||Thanks don. Here are few more concerns that I have:
1> Is there any way to zip the .bak files into just 1 file ising T-sql or wi
ll I have to resort to 3rd party solutions for compression (as .Net doesn't
have any compression lib)
2> What happens if one user chooses to backup while others are still working
on the same database (imagine a small office setup with few computers and m
y app on all of them and the db on one central machine). Will the backup wor
k fine in this situation or
will the users need to log off.
3> Also we are not aiming at schedule backups option right now. Our clients
will have to go to the UI screen and backup the database themselves when the
y want to. So in this situation should I restore system databases also when
the users choose to restore
my app's db from the backed up location. And do I need to backup the system
databases always when they choose to backup my apps db or just before any ma
jor important changes.
Thanks

reposting: bkup and resore strategy. Please reply

Hi,
My vb.net app will use database which will be deployed using MSDE on client machines. I will provide UI to client in my app to backup and restore the database. My app will work with one database, for e.g. MyAppDB. My question is what are the best pract
ices for doing this:
a) Should I choose Full or Simple mode. There is no mission critical data. But as my clients will be using MSDE, will setting up the recovery mode as Full cause the database and log size limits to cross the 2GB limit soon. Is it better if I choose SIMP
LE recovery mode. What do you suggest.
b) Should I back up the system databases also, if yes then what should be the order of backing these up (and then in what order should the databases be restored)
c) Does the MSDE login information also needs to be backed up. At max I will have just one custom login and sa. I am using SQL Authentication.
d) Will I need to close my application and make sure that my apps' MSDE instance is not running before backing up the databases.
d) I want to provide user the option to choose the backup location. How will I figure out if they chose something like tape drive or zip drive. How should I handle this scenario.
e) Also how can I find out if there is sufficient space on the hard drive to backup the database. Are there any standard sql functions to check that.
f) Should I do database log file backup too while backing up the database.
sorry for so many questions.
thanks
newbie
Print | Copy URL of this post
Expand All Collapse All
See answers inline:
"newbie" <anonymous@.discussions.microsoft.com> wrote in message
news:3DFC5E47-73A3-4CFC-9161-0AF13E789AD5@.microsoft.com...
> Hi,
> My vb.net app will use database which will be deployed using MSDE on
client machines. I will provide UI to client in my app to backup and
restore the database. My app will work with one database, for e.g. MyAppDB.
My question is what are the best practices for doing this:
> a) Should I choose Full or Simple mode. There is no mission critical
data. But as my clients will be using MSDE, will setting up the recovery
mode as Full cause the database and log size limits to cross the 2GB limit
soon. Is it better if I choose SIMPLE recovery mode. What do you suggest.
I almost always use either full or bulk-logged, although there are a few
instances where simple is appropriate. Basically you need to determine in
the event of failure do you want to be able to recover to the point of
failure, or is it good engoug to recover from the last full backup? As for
size limits, you can control the size of the log by backing it up regularly.
Besides, I am pretty sure that the 2Gb size limit is on the data file, not
the log.

> b) Should I back up the system databases also, if yes then what should be
the order of backing these up (and then in what order should the databases
be restored)
Yes, at least master and msdb, but the order of backing them up is not
important. Master would be the first to be restored

> c) Does the MSDE login information also needs to be backed up. At max I
will have just one custom login and sa. I am using SQL Authentication.
The logins are stored in master.

> d) Will I need to close my application and make sure that my apps' MSDE
instance is not running before backing up the databases.
No, backups are an online operation.

> d) I want to provide user the option to choose the backup location. How
will I figure out if they chose something like tape drive or zip drive. How
should I handle this scenario.
That's an application issue, you stated that you were providing them a front
end UI to backup the databases. The destination of the backup files is just
one of the BACKUP command arguments. There are also several arguments that
apply only to tape backup operations that you might want to take into
consideration.

> e) Also how can I find out if there is sufficient space on the hard drive
to backup the database. Are there any standard sql functions to check that.
There isn't a function that will estimate the size of the backup, but you
can read the msdb..backupset table to get the size of the last backup (or an
average of the last several) and estimate the size based on that.

> f) Should I do database log file backup too while backing up the database.
Not at the same time, although it won't hurt anything, there's just no
reason to do them at the same time.

> sorry for so many questions.
> thanks
> newbie
>
> Print | Copy URL of this post
>
> Expand All Collapse All
>
|||Thanks don. Here are few more concerns that I have:
1> Is there any way to zip the .bak files into just 1 file ising T-sql or will I have to resort to 3rd party solutions for compression (as .Net doesn't have any compression lib)
2> What happens if one user chooses to backup while others are still working on the same database (imagine a small office setup with few computers and my app on all of them and the db on one central machine). Will the backup work fine in this situation or
will the users need to log off.
3> Also we are not aiming at schedule backups option right now. Our clients will have to go to the UI screen and backup the database themselves when they want to. So in this situation should I restore system databases also when the users choose to restore
my app's db from the backed up location. And do I need to backup the system databases always when they choose to backup my apps db or just before any major important changes.
Thanks

Saturday, February 25, 2012

Repost: 00000 display on upgrade to Windows XP

I posted this under 'microsoft.public.sqlserver.client' but got no reply.
Any help with this problem would be greatly appreciated
-------
I developed a database under SQL Server 2000, with Access 2000 on Windows
2000 as client. This had been running fine for several years. The client is
now upgrading to Windows XP, and has come across a display problem on the
reports. The figures are correct but are now displayed with lots of trailing
zeros e.g

365.00000

I have built a test system but cannot duplicate the problem :-( . Also the
problem varies between computers, and even between different users on the
same computer. One solution that seems to work is to explicitly cast all
output from the server e.g.

CAST ( TonsLoaded AS INT) TonsLoaded

but this is a pita since there are 141 stored procedures.

Has anyone seen this problem? I haven't found anything in the newsgroups or
any Knowlege Base article. It looks like it is to do with Windows XP as the
client ...

David"David Greenwood" <david at greenwood dot lu> wrote in message
news:40274c80$1_1@.news.vo.lu...
> I posted this under 'microsoft.public.sqlserver.client' but got no reply.
> Any help with this problem would be greatly appreciated
> -------
> I developed a database under SQL Server 2000, with Access 2000 on Windows
> 2000 as client. This had been running fine for several years. The client
is
> now upgrading to Windows XP, and has come across a display problem on the
> reports. The figures are correct but are now displayed with lots of
trailing
> zeros e.g
> 365.00000
> I have built a test system but cannot duplicate the problem :-( . Also
the
> problem varies between computers, and even between different users on the
> same computer. One solution that seems to work is to explicitly cast all
> output from the server e.g.
> CAST ( TonsLoaded AS INT) TonsLoaded
> but this is a pita since there are 141 stored procedures.
> Has anyone seen this problem? I haven't found anything in the newsgroups
or
> any Knowlege Base article. It looks like it is to do with Windows XP as
the
> client ...
> David

If the behaviour varies between users on the same PC, then the issue may be
somehow related to the language or regional settings in their profiles,
although 4 decimal places seems like a strange format. Or possibly the
updated MDAC version in Windows XP is behaving slightly differently. What
data type is the TonsLoaded column in the result set - decimal?

In any case, I guess you should be able to modify your Access client to
display these figures as integers - it's usually easier to handle display
issues in the front end. And you might consider posting this in an Access
newsgroup (if you haven't already), in case it's a known Access/XP issue.

Simon|||If the worse comes to the worse then I shall just have to fix the problem on
the client end, somehow. But this is a big file (10 mega) full of forms and
reports so that will be a major job.

I checked on the client's system and either there are 3 trailing zeros or 6
trailing zeros, though I can't see why. Also, it appears that all the
machines have exactly the same problem. The only difference I can see with
my test system is that they have Active Directory ... (?)

I shall try posting to the Access newsgroup as you suggested.

David

"Simon Hayes" <sql@.hayes.ch> wrote in message
news:4027d81a$1_2@.news.bluewin.ch...
> "David Greenwood" <david at greenwood dot lu> wrote in message
> news:40274c80$1_1@.news.vo.lu...
> > I posted this under 'microsoft.public.sqlserver.client' but got no
reply.
> > Any help with this problem would be greatly appreciated
> > -------
> > I developed a database under SQL Server 2000, with Access 2000 on
Windows
> > 2000 as client. This had been running fine for several years. The client
> is
> > now upgrading to Windows XP, and has come across a display problem on
the
> > reports. The figures are correct but are now displayed with lots of
> trailing
> > zeros e.g
> > 365.00000
> > I have built a test system but cannot duplicate the problem :-( . Also
> the
> > problem varies between computers, and even between different users on
the
> > same computer. One solution that seems to work is to explicitly cast all
> > output from the server e.g.
> > CAST ( TonsLoaded AS INT) TonsLoaded
> > but this is a pita since there are 141 stored procedures.
> > Has anyone seen this problem? I haven't found anything in the newsgroups
> or
> > any Knowlege Base article. It looks like it is to do with Windows XP as
> the
> > client ...
> > David
> If the behaviour varies between users on the same PC, then the issue may
be
> somehow related to the language or regional settings in their profiles,
> although 4 decimal places seems like a strange format. Or possibly the
> updated MDAC version in Windows XP is behaving slightly differently. What
> data type is the TonsLoaded column in the result set - decimal?
> In any case, I guess you should be able to modify your Access client to
> display these figures as integers - it's usually easier to handle display
> issues in the front end. And you might consider posting this in an Access
> newsgroup (if you haven't already), in case it's a known Access/XP issue.
> Simon|||David Greenwood (david at greenwood dot lu) writes:
> I posted this under 'microsoft.public.sqlserver.client' but got no reply.
> Any help with this problem would be greatly appreciated
> -------
> I developed a database under SQL Server 2000, with Access 2000 on
> Windows 2000 as client. This had been running fine for several years.
> The client is now upgrading to Windows XP, and has come across a display
> problem on the reports. The figures are correct but are now displayed
> with lots of trailing zeros e.g
> 365.00000
> I have built a test system but cannot duplicate the problem :-( . Also
> the problem varies between computers, and even between different users
> on the same computer. One solution that seems to work is to explicitly
> cast all output from the server e.g.

I have to admit that I saw your post in .clients, but I let it pass, since
1) I don't know Access, 2) There seems to be information missing from
your posting.

What data type are the columns in SQL Server? How does the code look
like in Access to bring the data from SQL Server to the output? Do you
just associate a record set with a window control, or is there some
processing on the way?

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||I rebuilt my test Windows XP system, managed to duplicate the error, and
have at last got to the bottom of the problem. It would appear that Windows
XP does not correctly interprets the data for fields based on the SQL Server
"decimal" type, even though this has always worked fine under Windows 2000.

We use decimal fields with fixed three decimal places to store tonnes and
kilos. Once these have been totalled, averaged etc they automatically track
6 decimal places of precision. After ROUNDing to 0 places the data is
returned to the client. However, running tests under Query Analyser shows
that the 6 zeros are still part of the decimal answer. Windows 2000 has
never had a problem with this, no matter what the language settings. The
data has displayed okay. In contrast, Windows XP chokes on the data. I
guess not many people use the decimal data type, so this has not been an
issue.

The work round is to CAST the data to either INT or FLOAT as required on the
server.

Thanks for the feedback,

David

"Erland Sommarskog" <sommar@.algonet.se> wrote in message
news:Xns948AF2EB79AB2Yazorman@.127.0.0.1...
> David Greenwood (david at greenwood dot lu) writes:
> > I posted this under 'microsoft.public.sqlserver.client' but got no
reply.
> > Any help with this problem would be greatly appreciated
> > -------
> > I developed a database under SQL Server 2000, with Access 2000 on
> > Windows 2000 as client. This had been running fine for several years.
> > The client is now upgrading to Windows XP, and has come across a display
> > problem on the reports. The figures are correct but are now displayed
> > with lots of trailing zeros e.g
> > 365.00000
> > I have built a test system but cannot duplicate the problem :-( . Also
> > the problem varies between computers, and even between different users
> > on the same computer. One solution that seems to work is to explicitly
> > cast all output from the server e.g.
> I have to admit that I saw your post in .clients, but I let it pass, since
> 1) I don't know Access, 2) There seems to be information missing from
> your posting.
> What data type are the columns in SQL Server? How does the code look
> like in Access to bring the data from SQL Server to the output? Do you
> just associate a record set with a window control, or is there some
> processing on the way?
>
> --
> Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp|||David Greenwood (david at greenwood dot lu) writes:
> We use decimal fields with fixed three decimal places to store tonnes
> and kilos. Once these have been totalled, averaged etc they
> automatically track 6 decimal places of precision. After ROUNDing to 0
> places the data is returned to the client. However, running tests under
> Query Analyser shows that the 6 zeros are still part of the decimal
> answer. Windows 2000 has never had a problem with this, no matter what
> the language settings. The data has displayed okay. In contrast,
> Windows XP chokes on the data. I guess not many people use the decimal
> data type, so this has not been an issue.

You still don't tell us what you are doing, so I have to guess that you
are doing something like:

declare @.d decimal(18, 6)
select @.d = 21
select round(@.d, 0)

This displays as 21.000000 everywhere I tried, and this appears correct to
me. The return value of round() is the same as the input value.

I don't think Windows XP vs. 2000 has anything to do it. I tried it on
two Windows 2000 machines, and I got 21.00000 back on both. Rather I
would guess that it depends on the MDAC version. Windows XP comes with
MDAC 2.7, whereas Windows 2000 comes with MDAC 2.5 or even earlier, but
to get full use of SQL 2000, it's good to have MDAC 2.6 at least.

Interesting enough, I ran the above from ISQL, which uses DB-Library,
which is not part of the MDAC, and basically unchanged since 1997. It,
too, displays 21.000000.

So it seems that your code took a shortcut, depending of what actually is a
bug in an earlier versions on the MDAC.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp