Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Wednesday, March 21, 2012

Extended Stored Procedure problem (srv_describe function)...

Hello all,

I have spend quite some time now but don't manage to
find out how to have the srv_describe function working
properly for target NUMERIC(x,x) and NUMERIC types.

Already tried several alternatives like e.g.

// ...
PVOID pvdata1;
strcpy((char*)pvdata1, "12345.6789");
wsprintf(colname, "Score");
srv_describe(srvproc
, 1 /* column #1 */
, colname /* column name */
, SRV_NULLTERM /* column name ending */
, SRVNUMERIC
, (DBINT)sizeof(DBNUMERIC)
, SRVNUMERIC
, (DBINT)sizeof(DBNUMERIC)
, pvdata1);
srv_setcoldata(srvproc, 1, pvdata1);
srv_setcollen (srvproc, 1, strlen((char*)pvdata1));
// ...

but obviously does not work, I get an empty result
set.

I could only manage by converting the numeric value
to string from C and then sending only strings but the
SQL side expects actually a number(x,x) and is a customer
, in which case, I would never propose to be casting the
thing from TSQL.

Any ideas how to do it? The documentation and examples is
quite limited in this area.

Thanks in advance,
Best Regards,
GiovanniHello,

Sorry I made a mistake with the example, it is
actually:

// ...
PVOID pvdata1;
pvdata1 = new float[1];
((double*)pvdata1)[0] = 12345.6789f;
wsprintf(colname, "Score");
srv_describe(srvproc
, 1 /* column #1 */
, colname /* column name */
, SRV_NULLTERM /* column name ending */
, SRVNUMERIC
, (DBINT)sizeof(DBNUMERIC)
, SRVNUMERIC
, (DBINT)sizeof(DBNUMERIC)
, pvdata1);
srv_setcoldata(srvproc, 1, pvdata1);
srv_setcollen (srvproc, 1, sizeof(float));
// ...

Thanks in advance,
Best Regards,
Giovanni

"Giovanni Azua" <bravegag@.hotmail.com> wrote in message
news:2u9qr5F27hn83U1@.uni-berlin.de...
> Hello all,
> I have spend quite some time now but don't manage to
> find out how to have the srv_describe function working
> properly for target NUMERIC(x,x) and NUMERIC types.
> Already tried several alternatives like e.g.
> // ...
> PVOID pvdata1;
> strcpy((char*)pvdata1, "12345.6789");
> wsprintf(colname, "Score");
> srv_describe(srvproc
> , 1 /* column #1 */
> , colname /* column name */
> , SRV_NULLTERM /* column name ending */
> , SRVNUMERIC
> , (DBINT)sizeof(DBNUMERIC)
> , SRVNUMERIC
> , (DBINT)sizeof(DBNUMERIC)
> , pvdata1);
> srv_setcoldata(srvproc, 1, pvdata1);
> srv_setcollen (srvproc, 1, strlen((char*)pvdata1));
> // ...
> but obviously does not work, I get an empty result
> set.
> I could only manage by converting the numeric value
> to string from C and then sending only strings but the
> SQL side expects actually a number(x,x) and is a customer
> , in which case, I would never propose to be casting the
> thing from TSQL.
> Any ideas how to do it? The documentation and examples is
> quite limited in this area.
> Thanks in advance,
> Best Regards,
> Giovanni|||Giovanni Azua (bravegag@.hotmail.com) writes:
> Sorry I made a mistake with the example, it is
> actually:
> // ...
> PVOID pvdata1;
> pvdata1 = new float[1];
> ((double*)pvdata1)[0] = 12345.6789f;
> wsprintf(colname, "Score");
> srv_describe(srvproc
> , 1 /* column #1 */
> , colname /* column name */
> , SRV_NULLTERM /* column name ending */
> , SRVNUMERIC
> , (DBINT)sizeof(DBNUMERIC)
> , SRVNUMERIC
> , (DBINT)sizeof(DBNUMERIC)
> , pvdata1);
> srv_setcoldata(srvproc, 1, pvdata1);
> srv_setcollen (srvproc, 1, sizeof(float));
> // ...

I have not done very much XP programming, so I might be missing something
here. But I think you have the srctype and stclen parameters wrong.
pvdatal is not numeric, but a string. If memory serves, a DBNUMRIC is a
struct with three bytes for precision, scale and sign and then a
16-byte array for the value. So your float is not likely to be correctly
interpreted.

Then again, if you don't get an empty result set, there may be more
problems. It would be more likely that you would get completely bogus
output.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

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

Monday, March 12, 2012

extend time out setting

Hi,
I really need some help here. I have a few sql clients that connects to
my sql server through wireless connection. Sometimes, these wireless
connections link is down for a few seconds. When user try to continue
to run some query, the db process dead error message appears. Is the
anyway to extend the time out setting to longer time so that this
problem could be minimise?
Thanks a million.Hi
I think this would be a configuration setting on the wireless adapter rather
than the SQL Server connection. You may want to also try sending some form o
f
keep-alive although this would increase the network traffic!
John
"masterwee@.gmail.com" wrote:

> Hi,
> I really need some help here. I have a few sql clients that connects to
> my sql server through wireless connection. Sometimes, these wireless
> connections link is down for a few seconds. When user try to continue
> to run some query, the db process dead error message appears. Is the
> anyway to extend the time out setting to longer time so that this
> problem could be minimise?
> Thanks a million.
>|||The dbprocess dead error indicates a terminated connection rather than a
timeout. The application needs to be smart enough to attempt to reconnect
following the error.
Hope this helps.
Dan Guzman
SQL Server MVP
<masterwee@.gmail.com> wrote in message
news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
> Hi,
> I really need some help here. I have a few sql clients that connects to
> my sql server through wireless connection. Sometimes, these wireless
> connections link is down for a few seconds. When user try to continue
> to run some query, the db process dead error message appears. Is the
> anyway to extend the time out setting to longer time so that this
> problem could be minimise?
> Thanks a million.
>|||I have similar problems on some remote sites. Some are running the client
over ISDN which naturally timesout and should pick up the line again when
there is activity. But when the user generates some activity we get the db
process dead message. We migrated these sites from Sybase which never had
these issues and seemed more robust in these situations.
Is there any config options we can use on the client or server to make the
connections less fickle?
Is there any updated client that might be more reliable?
We are using SQL Server 2000 Sp4 but the client is the one on the original
SQl Server 2000 CD.
Thanks,
"Dan Guzman" wrote:

> The dbprocess dead error indicates a terminated connection rather than a
> timeout. The application needs to be smart enough to attempt to reconnect
> following the error.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> <masterwee@.gmail.com> wrote in message
> news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
>|||Hi Marty
Unless you have the SQL Server tools on the client PC then there is no point
in using it on the client. You should make sure that a recent version of MDA
C
is on there, although I don't think this will cure the issue as the server
can not reach the client and it can not instigate the ISDN connection.
As Dan has stated you will need to handle the error and reconnect the client
if you get this error.
Has the client application changed from powerbuilder?
John
"Marty" wrote:
[vbcol=seagreen]
> I have similar problems on some remote sites. Some are running the client
> over ISDN which naturally timesout and should pick up the line again when
> there is activity. But when the user generates some activity we get the db
> process dead message. We migrated these sites from Sybase which never had
> these issues and seemed more robust in these situations.
> Is there any config options we can use on the client or server to make the
> connections less fickle?
> Is there any updated client that might be more reliable?
> We are using SQL Server 2000 Sp4 but the client is the one on the original
> SQl Server 2000 CD.
> Thanks,
>
> "Dan Guzman" wrote:
>|||John,
When any activity happens on the client, it wakes up the ISDN connection and
should carry on where it left off in the application, but it looks like the
Client does not re-connect to the server correctly.
I'm not sure which SQL Server tools you refer to?
As for MDAC, it will be the one on the CD, should there be a later version?
The application is written in C++ not Powerbuilder. It is the database which
has been migrated to SQL Server from Sybase, and the old Sybase Open Client
did not report these errors on the same ISDN line.
Thanks,
M
"John Bell" wrote:
[vbcol=seagreen]
> Hi Marty
> Unless you have the SQL Server tools on the client PC then there is no poi
nt
> in using it on the client. You should make sure that a recent version of M
DAC
> is on there, although I don't think this will cure the issue as the server
> can not reach the client and it can not instigate the ISDN connection.
> As Dan has stated you will need to handle the error and reconnect the clie
nt
> if you get this error.
> Has the client application changed from powerbuilder?
> John
> "Marty" wrote:
>|||Hi Marty
Use the MDAC checker from
http://msdn.microsoft.com/data/ref/mdac/downloads/. MDAC can be updated
through other products such as XP SP1, so you may not be on the same version
at all sites. You will need to change the client application so that if the
error is detected the connection is closed and re-open it. I don't know if
the Open Client has the intellegence to silently reconnect or if it was
sending a keep alive.
John
"Marty" wrote:
[vbcol=seagreen]
> John,
> When any activity happens on the client, it wakes up the ISDN connection a
nd
> should carry on where it left off in the application, but it looks like th
e
> Client does not re-connect to the server correctly.
> I'm not sure which SQL Server tools you refer to?
> As for MDAC, it will be the one on the CD, should there be a later version
?
> The application is written in C++ not Powerbuilder. It is the database whi
ch
> has been migrated to SQL Server from Sybase, and the old Sybase Open Clien
t
> did not report these errors on the same ISDN line.
> Thanks,
> M
>
> "John Bell" wrote:
>

extend time out setting

I have similar problems on some remote sites. Some are running the client
over ISDN which naturally timesout and should pick up the line again when
there is activity. But when the user generates some activity we get the db
process dead message. We migrated these sites from Sybase which never had
these issues and seemed more robust in these situations.
Is there any config options we can use on the client or server to make the
connections less fickle?
Is there any updated client that might be more reliable?
We are using SQL Server 2000 Sp4 but the client is the one on the original
SQl Server 2000 CD.
Thanks,
"Dan Guzman" wrote:

> The dbprocess dead error indicates a terminated connection rather than a
> timeout. The application needs to be smart enough to attempt to reconnect
> following the error.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> <masterwee@.gmail.com> wrote in message
> news:1162278624.684826.264940@.m73g2000cwd.googlegr oups.com...
>
Hi Marty
Unless you have the SQL Server tools on the client PC then there is no point
in using it on the client. You should make sure that a recent version of MDAC
is on there, although I don't think this will cure the issue as the server
can not reach the client and it can not instigate the ISDN connection.
As Dan has stated you will need to handle the error and reconnect the client
if you get this error.
Has the client application changed from powerbuilder?
John
"Marty" wrote:
[vbcol=seagreen]
> I have similar problems on some remote sites. Some are running the client
> over ISDN which naturally timesout and should pick up the line again when
> there is activity. But when the user generates some activity we get the db
> process dead message. We migrated these sites from Sybase which never had
> these issues and seemed more robust in these situations.
> Is there any config options we can use on the client or server to make the
> connections less fickle?
> Is there any updated client that might be more reliable?
> We are using SQL Server 2000 Sp4 but the client is the one on the original
> SQl Server 2000 CD.
> Thanks,
>
> "Dan Guzman" wrote:
|||John,
When any activity happens on the client, it wakes up the ISDN connection and
should carry on where it left off in the application, but it looks like the
Client does not re-connect to the server correctly.
I'm not sure which SQL Server tools you refer to?
As for MDAC, it will be the one on the CD, should there be a later version?
The application is written in C++ not Powerbuilder. It is the database which
has been migrated to SQL Server from Sybase, and the old Sybase Open Client
did not report these errors on the same ISDN line.
Thanks,
M
"John Bell" wrote:
[vbcol=seagreen]
> Hi Marty
> Unless you have the SQL Server tools on the client PC then there is no point
> in using it on the client. You should make sure that a recent version of MDAC
> is on there, although I don't think this will cure the issue as the server
> can not reach the client and it can not instigate the ISDN connection.
> As Dan has stated you will need to handle the error and reconnect the client
> if you get this error.
> Has the client application changed from powerbuilder?
> John
> "Marty" wrote:
|||Hi Marty
Use the MDAC checker from
http://msdn.microsoft.com/data/ref/mdac/downloads/. MDAC can be updated
through other products such as XP SP1, so you may not be on the same version
at all sites. You will need to change the client application so that if the
error is detected the connection is closed and re-open it. I don't know if
the Open Client has the intellegence to silently reconnect or if it was
sending a keep alive.
John
"Marty" wrote:
[vbcol=seagreen]
> John,
> When any activity happens on the client, it wakes up the ISDN connection and
> should carry on where it left off in the application, but it looks like the
> Client does not re-connect to the server correctly.
> I'm not sure which SQL Server tools you refer to?
> As for MDAC, it will be the one on the CD, should there be a later version?
> The application is written in C++ not Powerbuilder. It is the database which
> has been migrated to SQL Server from Sybase, and the old Sybase Open Client
> did not report these errors on the same ISDN line.
> Thanks,
> M
>
> "John Bell" wrote:

extend time out setting

Hi,
I really need some help here. I have a few sql clients that connects to
my sql server through wireless connection. Sometimes, these wireless
connections link is down for a few seconds. When user try to continue
to run some query, the db process dead error message appears. Is the
anyway to extend the time out setting to longer time so that this
problem could be minimise?
Thanks a million.Hi
I think this would be a configuration setting on the wireless adapter rather
than the SQL Server connection. You may want to also try sending some form of
keep-alive although this would increase the network traffic!
John
"masterwee@.gmail.com" wrote:
> Hi,
> I really need some help here. I have a few sql clients that connects to
> my sql server through wireless connection. Sometimes, these wireless
> connections link is down for a few seconds. When user try to continue
> to run some query, the db process dead error message appears. Is the
> anyway to extend the time out setting to longer time so that this
> problem could be minimise?
> Thanks a million.
>|||The dbprocess dead error indicates a terminated connection rather than a
timeout. The application needs to be smart enough to attempt to reconnect
following the error.
--
Hope this helps.
Dan Guzman
SQL Server MVP
<masterwee@.gmail.com> wrote in message
news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
> Hi,
> I really need some help here. I have a few sql clients that connects to
> my sql server through wireless connection. Sometimes, these wireless
> connections link is down for a few seconds. When user try to continue
> to run some query, the db process dead error message appears. Is the
> anyway to extend the time out setting to longer time so that this
> problem could be minimise?
> Thanks a million.
>|||I have similar problems on some remote sites. Some are running the client
over ISDN which naturally timesout and should pick up the line again when
there is activity. But when the user generates some activity we get the db
process dead message. We migrated these sites from Sybase which never had
these issues and seemed more robust in these situations.
Is there any config options we can use on the client or server to make the
connections less fickle?
Is there any updated client that might be more reliable?
We are using SQL Server 2000 Sp4 but the client is the one on the original
SQl Server 2000 CD.
Thanks,
"Dan Guzman" wrote:
> The dbprocess dead error indicates a terminated connection rather than a
> timeout. The application needs to be smart enough to attempt to reconnect
> following the error.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> <masterwee@.gmail.com> wrote in message
> news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
> > Hi,
> >
> > I really need some help here. I have a few sql clients that connects to
> > my sql server through wireless connection. Sometimes, these wireless
> > connections link is down for a few seconds. When user try to continue
> > to run some query, the db process dead error message appears. Is the
> > anyway to extend the time out setting to longer time so that this
> > problem could be minimise?
> >
> > Thanks a million.
> >
>|||Hi Marty
Unless you have the SQL Server tools on the client PC then there is no point
in using it on the client. You should make sure that a recent version of MDAC
is on there, although I don't think this will cure the issue as the server
can not reach the client and it can not instigate the ISDN connection.
As Dan has stated you will need to handle the error and reconnect the client
if you get this error.
Has the client application changed from powerbuilder?
John
"Marty" wrote:
> I have similar problems on some remote sites. Some are running the client
> over ISDN which naturally timesout and should pick up the line again when
> there is activity. But when the user generates some activity we get the db
> process dead message. We migrated these sites from Sybase which never had
> these issues and seemed more robust in these situations.
> Is there any config options we can use on the client or server to make the
> connections less fickle?
> Is there any updated client that might be more reliable?
> We are using SQL Server 2000 Sp4 but the client is the one on the original
> SQl Server 2000 CD.
> Thanks,
>
> "Dan Guzman" wrote:
> > The dbprocess dead error indicates a terminated connection rather than a
> > timeout. The application needs to be smart enough to attempt to reconnect
> > following the error.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > <masterwee@.gmail.com> wrote in message
> > news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
> > > Hi,
> > >
> > > I really need some help here. I have a few sql clients that connects to
> > > my sql server through wireless connection. Sometimes, these wireless
> > > connections link is down for a few seconds. When user try to continue
> > > to run some query, the db process dead error message appears. Is the
> > > anyway to extend the time out setting to longer time so that this
> > > problem could be minimise?
> > >
> > > Thanks a million.
> > >
> >|||John,
When any activity happens on the client, it wakes up the ISDN connection and
should carry on where it left off in the application, but it looks like the
Client does not re-connect to the server correctly.
I'm not sure which SQL Server tools you refer to?
As for MDAC, it will be the one on the CD, should there be a later version?
The application is written in C++ not Powerbuilder. It is the database which
has been migrated to SQL Server from Sybase, and the old Sybase Open Client
did not report these errors on the same ISDN line.
Thanks,
M
"John Bell" wrote:
> Hi Marty
> Unless you have the SQL Server tools on the client PC then there is no point
> in using it on the client. You should make sure that a recent version of MDAC
> is on there, although I don't think this will cure the issue as the server
> can not reach the client and it can not instigate the ISDN connection.
> As Dan has stated you will need to handle the error and reconnect the client
> if you get this error.
> Has the client application changed from powerbuilder?
> John
> "Marty" wrote:
> > I have similar problems on some remote sites. Some are running the client
> > over ISDN which naturally timesout and should pick up the line again when
> > there is activity. But when the user generates some activity we get the db
> > process dead message. We migrated these sites from Sybase which never had
> > these issues and seemed more robust in these situations.
> >
> > Is there any config options we can use on the client or server to make the
> > connections less fickle?
> > Is there any updated client that might be more reliable?
> > We are using SQL Server 2000 Sp4 but the client is the one on the original
> > SQl Server 2000 CD.
> >
> > Thanks,
> >
> >
> >
> > "Dan Guzman" wrote:
> >
> > > The dbprocess dead error indicates a terminated connection rather than a
> > > timeout. The application needs to be smart enough to attempt to reconnect
> > > following the error.
> > >
> > > --
> > > Hope this helps.
> > >
> > > Dan Guzman
> > > SQL Server MVP
> > >
> > > <masterwee@.gmail.com> wrote in message
> > > news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
> > > > Hi,
> > > >
> > > > I really need some help here. I have a few sql clients that connects to
> > > > my sql server through wireless connection. Sometimes, these wireless
> > > > connections link is down for a few seconds. When user try to continue
> > > > to run some query, the db process dead error message appears. Is the
> > > > anyway to extend the time out setting to longer time so that this
> > > > problem could be minimise?
> > > >
> > > > Thanks a million.
> > > >
> > >|||Hi Marty
Use the MDAC checker from
http://msdn.microsoft.com/data/ref/mdac/downloads/. MDAC can be updated
through other products such as XP SP1, so you may not be on the same version
at all sites. You will need to change the client application so that if the
error is detected the connection is closed and re-open it. I don't know if
the Open Client has the intellegence to silently reconnect or if it was
sending a keep alive.
John
"Marty" wrote:
> John,
> When any activity happens on the client, it wakes up the ISDN connection and
> should carry on where it left off in the application, but it looks like the
> Client does not re-connect to the server correctly.
> I'm not sure which SQL Server tools you refer to?
> As for MDAC, it will be the one on the CD, should there be a later version?
> The application is written in C++ not Powerbuilder. It is the database which
> has been migrated to SQL Server from Sybase, and the old Sybase Open Client
> did not report these errors on the same ISDN line.
> Thanks,
> M
>
> "John Bell" wrote:
> > Hi Marty
> >
> > Unless you have the SQL Server tools on the client PC then there is no point
> > in using it on the client. You should make sure that a recent version of MDAC
> > is on there, although I don't think this will cure the issue as the server
> > can not reach the client and it can not instigate the ISDN connection.
> >
> > As Dan has stated you will need to handle the error and reconnect the client
> > if you get this error.
> >
> > Has the client application changed from powerbuilder?
> >
> > John
> >
> > "Marty" wrote:
> >
> > > I have similar problems on some remote sites. Some are running the client
> > > over ISDN which naturally timesout and should pick up the line again when
> > > there is activity. But when the user generates some activity we get the db
> > > process dead message. We migrated these sites from Sybase which never had
> > > these issues and seemed more robust in these situations.
> > >
> > > Is there any config options we can use on the client or server to make the
> > > connections less fickle?
> > > Is there any updated client that might be more reliable?
> > > We are using SQL Server 2000 Sp4 but the client is the one on the original
> > > SQl Server 2000 CD.
> > >
> > > Thanks,
> > >
> > >
> > >
> > > "Dan Guzman" wrote:
> > >
> > > > The dbprocess dead error indicates a terminated connection rather than a
> > > > timeout. The application needs to be smart enough to attempt to reconnect
> > > > following the error.
> > > >
> > > > --
> > > > Hope this helps.
> > > >
> > > > Dan Guzman
> > > > SQL Server MVP
> > > >
> > > > <masterwee@.gmail.com> wrote in message
> > > > news:1162278624.684826.264940@.m73g2000cwd.googlegroups.com...
> > > > > Hi,
> > > > >
> > > > > I really need some help here. I have a few sql clients that connects to
> > > > > my sql server through wireless connection. Sometimes, these wireless
> > > > > connections link is down for a few seconds. When user try to continue
> > > > > to run some query, the db process dead error message appears. Is the
> > > > > anyway to extend the time out setting to longer time so that this
> > > > > problem could be minimise?
> > > > >
> > > > > Thanks a million.
> > > > >
> > > >

Friday, March 9, 2012

Expressions as a field value in a table

Is there a way to store an expression inside a table, and have the expression
being pulled from the table to execute during run time? I want to dynamically
create an expression based on the value of a column of the table. Using the
IIF statement will work but it's going to be a very long nested IIF.... and
that brings to the second question -> is there a limit for the length of an
expression?
Thanks in advance.There is no limit on the length of an expression (other than limits imposed
by the VB.NET compiler).
In your case, you may want to look at alternatives to the IIF function:
* =Choose(...)
http://msdn.microsoft.com/library/en-us/vblr7/html/vafctchoose.asp
* =Switch(...)
http://msdn.microsoft.com/library/en-us/vblr7/html/vafctswitch.asp
In addition, you may want to consider writing a function in custom code or
as custom assembly that contains your logic. You can then reuse the function
from RDL expressions.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"g3kamdbs" <g3kamdbs@.discussions.microsoft.com> wrote in message
news:2A1DC075-220C-4494-AF82-157760B3EBD5@.microsoft.com...
> Is there a way to store an expression inside a table, and have the
> expression
> being pulled from the table to execute during run time? I want to
> dynamically
> create an expression based on the value of a column of the table. Using
> the
> IIF statement will work but it's going to be a very long nested IIF....
> and
> that brings to the second question -> is there a limit for the length of
> an
> expression?
> Thanks in advance.|||Or a User Defined Function that the Stored Procedure calls.
GeoSynch
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:uO3ZYBwvFHA.252@.TK2MSFTNGP09.phx.gbl...
> There is no limit on the length of an expression (other than limits imposed by
> the VB.NET compiler).
> In your case, you may want to look at alternatives to the IIF function:
> * =Choose(...)
> http://msdn.microsoft.com/library/en-us/vblr7/html/vafctchoose.asp
> * =Switch(...)
> http://msdn.microsoft.com/library/en-us/vblr7/html/vafctswitch.asp
> In addition, you may want to consider writing a function in custom code or as
> custom assembly that contains your logic. You can then reuse the function from
> RDL expressions.
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "g3kamdbs" <g3kamdbs@.discussions.microsoft.com> wrote in message
> news:2A1DC075-220C-4494-AF82-157760B3EBD5@.microsoft.com...
>> Is there a way to store an expression inside a table, and have the expression
>> being pulled from the table to execute during run time? I want to dynamically
>> create an expression based on the value of a column of the table. Using the
>> IIF statement will work but it's going to be a very long nested IIF.... and
>> that brings to the second question -> is there a limit for the length of an
>> expression?
>> Thanks in advance.
>

Expression question

I don't know any other way to ask it than to post my code and ask what's wrong w/ it. It looks right to me, but I'm getting an error every time. Any and all suggestions are greatly appreciated!
This one returns a value of False:
=iif( Fields!Appearance.Value=4, Fields!Appearance.Value="Poor", iif( Fields!Appearance.Value=3,Fields!Appearance.Value="Fair", iif( Fields!Appearance.Value=2,Fields!Appearance.Value="Good", iif( Fields!Appearance.Value=1,Fields!Appearance.Value="Excellent", Fields!Appearance.Value="Unknown"))))
This one just errors out:
=Select Case Month(Fields!SubmitDate.Value)
case 1
Month(Fields!SubmitDate.Value)= "January"
case 2
Month(Fields!SubmitDate.Value)= "February"
case 3
Month(Fields!SubmitDate.Value)= "March"
case 4
Month(Fields!SubmitDate.Value)= "April"
case 5
Month(Fields!SubmitDate.Value)= "May"
case 6
Month(Fields!SubmitDate.Value)= "June"
case 7
Month(Fields!SubmitDate.Value)= "July"
case 8
Month(Fields!SubmitDate.Value)= "August"
case 9
Month(Fields!SubmitDate.Value)= "September"
case 10
Month(Fields!SubmitDate.Value)= "October"
case 11
Month(Fields!SubmitDate.Value)= "November"
case 12
Month(Fields!SubmitDate.Value)= "December"
case Else
Month(Fields!SubmitDate.Value)= "Unknown"
I've fixed the first expression...here's the new code:
=iif( Fields!Appearance.Value=4, "Poor", iif( Fields!Appearance.Value=3, "Fair", iif( Fields!Appearance.Value=2, "Good", iif( Fields!Appearance.Value=1, "Excellent","Unknown"))))
Still having trouble w/ the case statement though
|||

Instead of using a case statement try this:

=MonthName(DatePart("m",Fields!SubmitDate.Value))

Wednesday, March 7, 2012

expression for regional report

Hi all thnaks in advacne for your time im new to MS reprting and am
writing my first report albeit very slow but im getting there is there
a way for me to
for instance i am reporting on a number of sales in different
countries so i would like the total sales to show as =A3 for uk sales
and the euro sign for spain, france, italy etc?
i can determine the county but just need to know if i can change the
currency?
CheersOn May 25, 9:58 am, blueboy <matt_me...@.hotmail.com> wrote:
> Hi all thnaks in advacne for your time im new to MS reprting and am
> writing my first report albeit very slow but im getting there is there
> a way for me to
> for instance i am reporting on a number of sales in different
> countries so i would like the total sales to show as =A3 for uk sales
> and the euro sign for spain, france, italy etc?
> i can determine the county but just need to know if i can change the
> currency?
> Cheers
I don't think you can have multiple currencies because the currency is
represented based on Locale:
http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterSQLReportingServices=
.aspx#CurrencySetting
If you can find a way to put multiple locals, or you have data for
different countries on separate tables then you can probably change
the currency. You may want to try an IIF command. In that link, it
shows you how to change the locale. You can use an expression in
there. For the formula you can use something like
=3DIIF(FIELD!<Name of your field>.value=3D'UK',English (United
Kingdom),English(United States))
So if the value for the field that identifies the record as one from
the UK is true, it will format it as british pounds, otherwise it will
format it as US $. You want more than one country, just nest IIF
commands as such:
=3DIIF(FIELD!<Name of your field>.value=3D'UK',English (United
Kingdom),IIF(FIELD!<Name of your field>.value=3D'USA',English(United
States), Arabic (Egypt)))
etc... it gets complicated after a few permutations. Try it with a
simple IIF like I first demonstrated and see how it goes. I have a
complex nested IIF in one of my GO TO URL buttons for selected between
3-4 different reports and passing parameters so I know it works.
Note: my syntax might not be perfect but I believe the concept is
correct and you can always find sources on here that will show you how
to properly write IIF commands.
Hope this helps!

Expression does not notice Global Variable's new value

I'm trying to do something very simple, and having a tough time with it.

I've got a Global Variable that gets a string value assigned to it in a Script Task, and then I need to access that value in Execute Process Task Expression. When running, by the time it gets to the Process Task, the global variable's value in the expression is still blank, even though a breakpoint on the task shows that it does have a value.

What am I doing wrong? This seems too simple to give me this much problem.

Make sure that you don't have another variable defined at the Script Task scope level.

Also, can you share the code you're using to set the value of the variable?|||

all variables are package scope level. I've got two variables for the script task set in the ReadWriteVariables area; pszFinCycle and ZipFile. ZipFile is the variable that has the value that will be used later in the Process Task.

Code Snippet

Dts.Variables("pszFinCycle").Value = Format(Now, "yyyyMMdd").ToString

Dts.Variables("ZipFile").Value = "EXTRACT" + Dts.Variables("pszFinCycle").Value.ToString + ".ZIP"

Dts.TaskResult = Dts.Results.Success

|||

DrinkGreen wrote:

all variables are package scope level.

Right. Make sure that when the script task is highlighted that you don't have ANOTHER variable defined at that scope. You can have multiple variables of the same name in a package that have different scopes.

The code looks good to me.|||Or that the Execute Process Task doesn't have another variable of the same name, but different scope.

Sunday, February 19, 2012

Exporting to PDF in Java with web interface issue

Hi, thanks for taking the time to take a look at this.

As you can read from the title, I'm trying to export a report to pdf from a thick java client. My connection string is:
"http://10.0.1.36/ReportServer/?/Invoice1/Invoice&assetNbr=14
&invoiceId=061000002&rs:Command=Render:&rs:Format=PDF&rc:Toolbar=false"
(I just added the toolbar=false part, and it didn't fix the problem)

After getting the datastream I just throw it into a file and it works fine... Until I add an image to my report. I don't get any errors in my program, but when I try to open up the pdf itself I get the error: "There was an error opening this document. The file is damaged and could not be repaired."

What confuses me is that if I enter the connection string in ie it comes up and asks me what I should do with the pdf and that one has the image in it with not problems.

To summarize if I've been unclear:
Export via ie no image: good
Export via ie with image: good
Export via java no image: good
Export via java with image: error

Does anyone have an idea why this would occur? I have an Execution Account set up in Reporting Services Configuration Manager and I have IIS anonymous access set up to use my local administrator account so I don't think accessing the image is an issue. But I'm definitely no server/admin expert so if there are any such issues could be causing this don't assume I've got that set up properly.

Thanks, JeffAre you certain that you are writing the file correctly from your Java app?|||I'm pretty sure I am. The whole setup works and exports correctly when connecting to a report that doesn't have an image embedded in it.

Also, is there any way to access the reports other than the web interface from java? I've only seen implementations of this in C# and vb.net|||

You should be able to use any Java SOAP toolkit (such as JAX).

FWIW, perhaps the report w/the image is larger, and exposing some bug in your Java code? Maybe you should compare the byte count of the IE output to what you are getting w/Java.

|||My face is red, it just was that I was stopping the fileout one byte too early... Thanks a bunch for your help.

If I can ask one more favor of you, I'm not familiar with the components involved in using SOAP so if you could give me a little overview that would give me someplace to start reading about it I'd really appreciate it.|||

I've never used any of SOAP toolkits for Java... so I can't really help you out there. This showed some links which may be of interest to you:

http://search.live.com/results.aspx?q=java+SOAP+toolkit&mkt=en-US&form=QBRE

Wednesday, February 15, 2012

Exporting SQL to Excel Hourly

First time here so please bear with me.

Set up a DTS package to export data to an excel sheet on an hourly
basis. Problem is, it keeps appending to the same excel sheet.

Any idea how to prevent that. All I want to accomplish is that every
hour, the latest data is in the excel sheet and the previous data is
deleted.

Thanks in advance!"Anthony" <anthony@.alfy.com> wrote in message
news:8ca54ab8.0406151028.65a8fbbb@.posting.google.c om...
> First time here so please bear with me.
> Set up a DTS package to export data to an excel sheet on an hourly
> basis. Problem is, it keeps appending to the same excel sheet.
> Any idea how to prevent that. All I want to accomplish is that every
> hour, the latest data is in the excel sheet and the previous data is
> deleted.
> Thanks in advance!

One solution could be to add an ActiveX or Execute Process task to simply
delete the existing XLS before exporting the data, so that you create it
again each time. This could be a problem if someone else has the XLS open at
that point, but presumably you've handled that already anyway.

Simon|||
Thanks Simon. Not to familiar with creating an ActiveX to do that. Any
idea how easy/hard it is? Maybe point me in the right direction?

Thanks again

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!|||Here is another approach.
1.) create a sql agent job and schedule it to run hourly.

2.) first step deletes the old excel file (change type to cmdexec and
"DEL \\<path>\<name>.xls" in the command line.

3.) second step creates a new excel file by copying a template file to
the path and file name you want.

4.) create a stored procedure that creates a linked server to the excel
spreadsheet (see BOL for sp_addlinkedserver), then exports the data to
it.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!|||Hi

These may be useful.
http://www.sqldts.com/default.aspx?292
http://www.sqldts.com/default.aspx?200
http://www.sqldts.com/default.aspx?245

If you need a specific template then you can copy an existing file and
rename it.

John

"Anthony Mehale" <anthony@.alfy.com> wrote in message
news:40cf49c7$0$25541$c397aba@.news.newsgroups.ws.. .
>
> Thanks Simon. Not to familiar with creating an ActiveX to do that. Any
> idea how easy/hard it is? Maybe point me in the right direction?
> Thanks again
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!|||Thanks Carl

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Exporting sorted data

Hi,

I have created a crystal report using visual studio. I have three fields in the report - Date, Time and No. of Clients. On loading report is sorted by Date and Time Fields. At run time I sort the report by number of cliets. It shows on Html fine but when i export it to PDF, it shows me the original data sorted by Date and Time. Has anyone run into similar problem ... any help would be appreciated.

Thanks,
DKOpen the report and Uncheck the option Save Data With reports option(from File menu), save the report and try|||hi,

I am using web application to show my crystal report and it does not have the option you told me to change.

I looked into all the options available ... and could not find "Save Data With reports option".

Thanks,
DK|||Hi dsaxena,

I don't think your problem is a "Save Data" problem. It sounds like you've discovered a bug/limitation with the viewer...there are a few.