OK, so it's Halloween time and everything, but give me a
break! Here at my organization we've been having this
happen on occasion for a quite a while (maybe for the
last year or so) - old versions of things such as DTS
packages and stored procedures come back and become the
current version of that particular object. Now, we store
our DTS packages here in the msdb database, and we
haven't always deleted old versions of those, so maybe
somehow they are floating back to the top of the version
list somehow. But stored procedures? Just today I went to
check out a stored procedure I had written a while back
so that I could show one of my co-workers the code within
it, and saw that it had mysteriously reverted back to the
way it was before I changed it months ago to add the
aforementioned code. We managed to find the correct
version of the procedure, luckily, in a backup of the
database we had lying around, or I would have had to re-
write it all over again. What is particularly disturbing
about this incident is that the former version of the
stored procedure will execute successfully and return
results that appear correct on the surface. Those results
are only slightly flawed and the damage won't come to
light until much later. Not good!
We have not done any restores that would have turned back
the database to the point before the procedure or package
change; it's just that this reverting action will occur
on its own periodically with no warning.
Has anyone else experienced this? Does anyone know why
it's happening and what can be done about it?
We're running SQL Server 2000 on Windows 2000 Advanced
Server, and the current service pack (SP3a) is applied.
Thank you,
Mark Schmidt
Database Administrator
Pennsylvania House of RepresentativesMark,
Do you at all rename stored procedures? Sp_rename does not change the proc name in create proc in
syscomments and this might be a reason...
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Mark Schmidt" <MSchmidt@.pa_housewithouttheunderscore.net> wrote in message
news:00c201c39cbb$bd022e40$a501280a@.phx.gbl...
> OK, so it's Halloween time and everything, but give me a
> break! Here at my organization we've been having this
> happen on occasion for a quite a while (maybe for the
> last year or so) - old versions of things such as DTS
> packages and stored procedures come back and become the
> current version of that particular object. Now, we store
> our DTS packages here in the msdb database, and we
> haven't always deleted old versions of those, so maybe
> somehow they are floating back to the top of the version
> list somehow. But stored procedures? Just today I went to
> check out a stored procedure I had written a while back
> so that I could show one of my co-workers the code within
> it, and saw that it had mysteriously reverted back to the
> way it was before I changed it months ago to add the
> aforementioned code. We managed to find the correct
> version of the procedure, luckily, in a backup of the
> database we had lying around, or I would have had to re-
> write it all over again. What is particularly disturbing
> about this incident is that the former version of the
> stored procedure will execute successfully and return
> results that appear correct on the surface. Those results
> are only slightly flawed and the damage won't come to
> light until much later. Not good!
> We have not done any restores that would have turned back
> the database to the point before the procedure or package
> change; it's just that this reverting action will occur
> on its own periodically with no warning.
> Has anyone else experienced this? Does anyone know why
> it's happening and what can be done about it?
> We're running SQL Server 2000 on Windows 2000 Advanced
> Server, and the current service pack (SP3a) is applied.
> Thank you,
> Mark Schmidt
> Database Administrator
> Pennsylvania House of Representatives|||Thank you for your response, Tibor.
No, we haven't renamed any procs to cause this. Actually,
it came to my attention after I posted my question that
the problem with the stored procedure that I mentioned
may very well have been somebody re-creating the
procedure with old code and not realizing it until later.
But, when it comes to DTS packages, we definitely have
had this phenomenon occur several times with no apparent
intervention on anyone's part.
Mark
>--Original Message--
>Mark,
>Do you at all rename stored procedures? Sp_rename does
not change the proc name in create proc in
>syscomments and this might be a reason...
>--
>Tibor Karaszi, SQL Server MVP
>Archive at: http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Mark Schmidt"
<MSchmidt@.pa_housewithouttheunderscore.net> wrote in
message
>news:00c201c39cbb$bd022e40$a501280a@.phx.gbl...
>> OK, so it's Halloween time and everything, but give me
a
>> break! Here at my organization we've been having this
>> happen on occasion for a quite a while (maybe for the
>> last year or so) - old versions of things such as DTS
>> packages and stored procedures come back and become the
>> current version of that particular object. Now, we
store
>> our DTS packages here in the msdb database, and we
>> haven't always deleted old versions of those, so maybe
>> somehow they are floating back to the top of the
version
>> list somehow. But stored procedures? Just today I went
to
>> check out a stored procedure I had written a while back
>> so that I could show one of my co-workers the code
within
>> it, and saw that it had mysteriously reverted back to
the
>> way it was before I changed it months ago to add the
>> aforementioned code. We managed to find the correct
>> version of the procedure, luckily, in a backup of the
>> database we had lying around, or I would have had to
re-
>> write it all over again. What is particularly
disturbing
>> about this incident is that the former version of the
>> stored procedure will execute successfully and return
>> results that appear correct on the surface. Those
results
>> are only slightly flawed and the damage won't come to
>> light until much later. Not good!
>> We have not done any restores that would have turned
back
>> the database to the point before the procedure or
package
>> change; it's just that this reverting action will occur
>> on its own periodically with no warning.
>> Has anyone else experienced this? Does anyone know why
>> it's happening and what can be done about it?
>> We're running SQL Server 2000 on Windows 2000 Advanced
>> Server, and the current service pack (SP3a) is applied.
>> Thank you,
>> Mark Schmidt
>> Database Administrator
>> Pennsylvania House of Representatives
>
>.
>|||> But, when it comes to DTS packages, we definitely have
> had this phenomenon occur several times with no apparent
> intervention on anyone's part.
I still suspect sp_rename... ;-)
But without a repro, it if of course impossible to say.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Mark Schmidt" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c39e52$ab954820$a001280a@.phx.gbl...
> Thank you for your response, Tibor.
> No, we haven't renamed any procs to cause this. Actually,
> it came to my attention after I posted my question that
> the problem with the stored procedure that I mentioned
> may very well have been somebody re-creating the
> procedure with old code and not realizing it until later.
> But, when it comes to DTS packages, we definitely have
> had this phenomenon occur several times with no apparent
> intervention on anyone's part.
> Mark
> >--Original Message--
> >Mark,
> >
> >Do you at all rename stored procedures? Sp_rename does
> not change the proc name in create proc in
> >syscomments and this might be a reason...
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at: http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Mark Schmidt"
> <MSchmidt@.pa_housewithouttheunderscore.net> wrote in
> message
> >news:00c201c39cbb$bd022e40$a501280a@.phx.gbl...
> >> OK, so it's Halloween time and everything, but give me
> a
> >> break! Here at my organization we've been having this
> >> happen on occasion for a quite a while (maybe for the
> >> last year or so) - old versions of things such as DTS
> >> packages and stored procedures come back and become the
> >> current version of that particular object. Now, we
> store
> >> our DTS packages here in the msdb database, and we
> >> haven't always deleted old versions of those, so maybe
> >> somehow they are floating back to the top of the
> version
> >> list somehow. But stored procedures? Just today I went
> to
> >> check out a stored procedure I had written a while back
> >> so that I could show one of my co-workers the code
> within
> >> it, and saw that it had mysteriously reverted back to
> the
> >> way it was before I changed it months ago to add the
> >> aforementioned code. We managed to find the correct
> >> version of the procedure, luckily, in a backup of the
> >> database we had lying around, or I would have had to
> re-
> >> write it all over again. What is particularly
> disturbing
> >> about this incident is that the former version of the
> >> stored procedure will execute successfully and return
> >> results that appear correct on the surface. Those
> results
> >> are only slightly flawed and the damage won't come to
> >> light until much later. Not good!
> >>
> >> We have not done any restores that would have turned
> back
> >> the database to the point before the procedure or
> package
> >> change; it's just that this reverting action will occur
> >> on its own periodically with no warning.
> >>
> >> Has anyone else experienced this? Does anyone know why
> >> it's happening and what can be done about it?
> >>
> >> We're running SQL Server 2000 on Windows 2000 Advanced
> >> Server, and the current service pack (SP3a) is applied.
> >>
> >> Thank you,
> >>
> >> Mark Schmidt
> >> Database Administrator
> >> Pennsylvania House of Representatives
> >
> >
> >.
> >|||Well, my developers are not telling me that they're doing
renames, and I have to go with that for now.
Thank you very much for the help and for something to
look for, Tibor.
Mark
>--Original Message--
>> But, when it comes to DTS packages, we definitely have
>> had this phenomenon occur several times with no
apparent
>> intervention on anyone's part.
>I still suspect sp_rename... ;-)
>But without a repro, it if of course impossible to say.
>--
>Tibor Karaszi, SQL Server MVP
>Archive at: http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Mark Schmidt" <anonymous@.discussions.microsoft.com>
wrote in message
>news:0a0f01c39e52$ab954820$a001280a@.phx.gbl...
>> Thank you for your response, Tibor.
>> No, we haven't renamed any procs to cause this.
Actually,
>> it came to my attention after I posted my question that
>> the problem with the stored procedure that I mentioned
>> may very well have been somebody re-creating the
>> procedure with old code and not realizing it until
later.
>> But, when it comes to DTS packages, we definitely have
>> had this phenomenon occur several times with no
apparent
>> intervention on anyone's part.
>> Mark
>> >--Original Message--
>> >Mark,
>> >
>> >Do you at all rename stored procedures? Sp_rename does
>> not change the proc name in create proc in
>> >syscomments and this might be a reason...
>> >
>> >--
>> >Tibor Karaszi, SQL Server MVP
>> >Archive at: http://groups.google.com/groups?
>> oi=djq&as_ugroup=microsoft.public.sqlserver
>> >
>> >
>> >"Mark Schmidt"
>> <MSchmidt@.pa_housewithouttheunderscore.net> wrote in
>> message
>> >news:00c201c39cbb$bd022e40$a501280a@.phx.gbl...
>> >> OK, so it's Halloween time and everything, but give
me
>> a
>> >> break! Here at my organization we've been having
this
>> >> happen on occasion for a quite a while (maybe for
the
>> >> last year or so) - old versions of things such as
DTS
>> >> packages and stored procedures come back and become
the
>> >> current version of that particular object. Now, we
>> store
>> >> our DTS packages here in the msdb database, and we
>> >> haven't always deleted old versions of those, so
maybe
>> >> somehow they are floating back to the top of the
>> version
>> >> list somehow. But stored procedures? Just today I
went
>> to
>> >> check out a stored procedure I had written a while
back
>> >> so that I could show one of my co-workers the code
>> within
>> >> it, and saw that it had mysteriously reverted back
to
>> the
>> >> way it was before I changed it months ago to add the
>> >> aforementioned code. We managed to find the correct
>> >> version of the procedure, luckily, in a backup of
the
>> >> database we had lying around, or I would have had to
>> re-
>> >> write it all over again. What is particularly
>> disturbing
>> >> about this incident is that the former version of
the
>> >> stored procedure will execute successfully and
return
>> >> results that appear correct on the surface. Those
>> results
>> >> are only slightly flawed and the damage won't come
to
>> >> light until much later. Not good!
>> >>
>> >> We have not done any restores that would have turned
>> back
>> >> the database to the point before the procedure or
>> package
>> >> change; it's just that this reverting action will
occur
>> >> on its own periodically with no warning.
>> >>
>> >> Has anyone else experienced this? Does anyone know
why
>> >> it's happening and what can be done about it?
>> >>
>> >> We're running SQL Server 2000 on Windows 2000
Advanced
>> >> Server, and the current service pack (SP3a) is
applied.
>> >>
>> >> Thank you,
>> >>
>> >> Mark Schmidt
>> >> Database Administrator
>> >> Pennsylvania House of Representatives
>> >
>> >
>> >.
>> >
>
>.
>sql
2012年3月22日星期四
2012年3月20日星期二
any way to rollback dbase
Hi just wondering if there is anyway to roll back a database? For example
the last time the database was backed up say 3 months ago and a restore was
done yesterday. Just wondering if there is anyway to undo the restore?
Thanks.
Paul G
Software engineer.
No, a database restore can't be undone because all data in the target are
replaced during the restore.
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
|||"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
Sure -- this can be easily done.
Assuming you have a backup you took immediately
prior to the restore.
What's that? You don't have one? Well, why not?
Chalk this one up as a lesson learned.
Really, there's no way without another backup
that was taken just prior to the restore.
|||Hi,
No you cant do a recovery back if you restore a full database backup.
Here after please do a backup and keep yourself safe before restoring.
Thanks
Hari
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
sql
the last time the database was backed up say 3 months ago and a restore was
done yesterday. Just wondering if there is anyway to undo the restore?
Thanks.
Paul G
Software engineer.
No, a database restore can't be undone because all data in the target are
replaced during the restore.
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
|||"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
Sure -- this can be easily done.
Assuming you have a backup you took immediately
prior to the restore.
What's that? You don't have one? Well, why not?
Chalk this one up as a lesson learned.
Really, there's no way without another backup
that was taken just prior to the restore.
|||Hi,
No you cant do a recovery back if you restore a full database backup.
Here after please do a backup and keep yourself safe before restoring.
Thanks
Hari
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
sql
any way to rollback dbase
Hi just wondering if there is anyway to roll back a database? For example
the last time the database was backed up say 3 months ago and a restore was
done yesterday. Just wondering if there is anyway to undo the restore?
Thanks.
--
Paul G
Software engineer.No, a database restore can't be undone because all data in the target are
replaced during the restore.
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.|||"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
Sure -- this can be easily done.
Assuming you have a backup you took immediately
prior to the restore.
What's that? You don't have one? Well, why not?
Chalk this one up as a lesson learned.
Really, there's no way without another backup
that was taken just prior to the restore.|||Hi,
No you cant do a recovery back if you restore a full database backup.
Here after please do a backup and keep yourself safe before restoring.
Thanks
Hari
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
the last time the database was backed up say 3 months ago and a restore was
done yesterday. Just wondering if there is anyway to undo the restore?
Thanks.
--
Paul G
Software engineer.No, a database restore can't be undone because all data in the target are
replaced during the restore.
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.|||"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
Sure -- this can be easily done.
Assuming you have a backup you took immediately
prior to the restore.
What's that? You don't have one? Well, why not?
Chalk this one up as a lesson learned.
Really, there's no way without another backup
that was taken just prior to the restore.|||Hi,
No you cant do a recovery back if you restore a full database backup.
Here after please do a backup and keep yourself safe before restoring.
Thanks
Hari
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
any way to rollback dbase
Hi just wondering if there is anyway to roll back a database? For example
the last time the database was backed up say 3 months ago and a restore was
done yesterday. Just wondering if there is anyway to undo the restore?
Thanks.
--
Paul G
Software engineer.No, a database restore can't be undone because all data in the target are
replaced during the restore.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.|||"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
Sure -- this can be easily done.
Assuming you have a backup you took immediately
prior to the restore.
What's that? You don't have one? Well, why not?
Chalk this one up as a lesson learned.
Really, there's no way without another backup
that was taken just prior to the restore.|||Hi,
No you cant do a recovery back if you restore a full database backup.
Here after please do a backup and keep yourself safe before restoring.
Thanks
Hari
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
the last time the database was backed up say 3 months ago and a restore was
done yesterday. Just wondering if there is anyway to undo the restore?
Thanks.
--
Paul G
Software engineer.No, a database restore can't be undone because all data in the target are
replaced during the restore.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.|||"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
Sure -- this can be easily done.
Assuming you have a backup you took immediately
prior to the restore.
What's that? You don't have one? Well, why not?
Chalk this one up as a lesson learned.
Really, there's no way without another backup
that was taken just prior to the restore.|||Hi,
No you cant do a recovery back if you restore a full database backup.
Here after please do a backup and keep yourself safe before restoring.
Thanks
Hari
SQL Server MVP
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9A8E7FFE-2DFA-4FAC-AE0F-2BB8BF026E1C@.microsoft.com...
> Hi just wondering if there is anyway to roll back a database? For example
> the last time the database was backed up say 3 months ago and a restore
> was
> done yesterday. Just wondering if there is anyway to undo the restore?
> Thanks.
> --
> Paul G
> Software engineer.
2012年3月19日星期一
Any way to avoid using a cursor and a script on this one?
A while back a db expert I was talking to expressed the opinion that
cursors were overused, mostly by programmers who were thinking like
programmers instead of db people.
I have a task to do and I'm not sure I can do it without a cursor.
I'm curious to see if anyone can think of a way around it.
In a nutshell I want to query the database to find all tables that have
a particular field( "comment"), include only results where that field
has one of 20 substrings in the content, and then print it all out.
So I have
(substring1, substring2 substring3 ...substring20)
and I would like to get output like
table_name comment substring
-- -- --
If I can find another way than using cursors or brute force ( many
cut-n-pasted tsql statements ) I would be grateful.
Thanks in advance for any thoughts
SteveWell this sounds like a one of a kind request. If it isn't you have some
serious design flaws. A cursor is useful for something like that where you
need to navigate multiple objects dynamically. What you should not use a
cursor for are things that can get the results via a SET based approach. For
instance you would not create a cursor to navigate each row of the table to
search for yoru string. You would do that in a SET based fashion.
Andrew J. Kelly SQL MVP
"Steve" <stevesusenet@.yahoo.com> wrote in message
news:1139531021.868263.148350@.g47g2000cwa.googlegroups.com...
>A while back a db expert I was talking to expressed the opinion that
> cursors were overused, mostly by programmers who were thinking like
> programmers instead of db people.
> I have a task to do and I'm not sure I can do it without a cursor.
> I'm curious to see if anyone can think of a way around it.
> In a nutshell I want to query the database to find all tables that have
> a particular field( "comment"), include only results where that field
> has one of 20 substrings in the content, and then print it all out.
> So I have
> (substring1, substring2 substring3 ...substring20)
> and I would like to get output like
> table_name comment substring
> -- -- --
> If I can find another way than using cursors or brute force ( many
> cut-n-pasted tsql statements ) I would be grateful.
> Thanks in advance for any thoughts
> Steve
>|||Hello, Steve
Let's take it one step at a time. First, we need a list of tables that
have a column named "comment":
SELECT o.name FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.name='comment'
Then, for each of the above tables, we would want to do something like
this:
SELECT 'Some table' as table_name, comment, sub_string
FROM [Some table] t INNER JOIN (
SELECT 'substring1' sub_string
UNION SELECT 'substring2'
UNION SELECT 'substring3'
/* ... */
) x ON t.comment LIKE '%'+sub_string+'%'
Instead of writing the substrings like above, we can use a temporary
table to store them:
CREATE TABLE #substrings (sub_string varchar(50) PRIMARY KEY)
INSERT INTO #substrings VALUES ('substring1')
INSERT INTO #substrings VALUES ('substring2')
INSERT INTO #substrings VALUES ('substring3')
/* ... */
Now we can generate the SELECT-s for all the tables, using the
following query:
SELECT '
SELECT '''+o.name+''' as table_name, comment, sub_string
FROM ['+o.name+'] t INNER JOIN #substrings x
ON t.comment LIKE ''%''+sub_string+''%''
' FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.name='comment'
After executing the above query, copy the results into another query
window and execute them.
We can stop here, but let's make it more automatic: we can use a WHILE
loop to execute each statement (yes, this resembles a cursor very
much...) that puts the results in a temporary table:
CREATE TABLE #results (table_name sysname, comment ntext, sub_string
varchar(50))
create table #statements (id int identity primary key, sql
nvarchar(4000))
insert into #statements
SELECT '
INSERT INTO #results SELECT '''+o.name+''' as table_name, comment,
sub_string
FROM ['+o.name+'] t INNER JOIN #substrings x
ON t.comment LIKE ''%''+sub_string+''%''
' FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.name='comment'
declare @.id int, @.sql nvarchar(4000)
set @.id=0
while 1=1 begin
set @.id=(select min(id) from #statements where id>@.id)
if @.id is null break
select @.sql=sql from #statements where id=@.id
exec (@.sql)
end
drop table #statements
select * from #results
drop table #results
If you don't like the WHILE loop, we can write something shorter, using
an undocumented stored procedure: sp_execresultset (of course, using
undocumented features is not recommended, but this is a one-time job,
isn't it?)
CREATE TABLE #results (table_name sysname, comment ntext, sub_string
varchar(50))
EXEC sp_execresultset '
SELECT ''
INSERT INTO #results SELECT '''+o.name+''' as table_name,
comment, sub_string
FROM [''+o.name+''] t INNER JOIN #substrings x
ON t.comment LIKE ''''%''''+sub_string+''''%''''
'' FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype=''U'' AND c.name=''comment''
'
select * from #results
drop table #results
Razvan|||Thanks for the code Razvan!|||Steve wrote:
> A while back a db expert I was talking to expressed the opinion that
> cursors were overused, mostly by programmers who were thinking like
> programmers instead of db people.
> I have a task to do and I'm not sure I can do it without a cursor.
> I'm curious to see if anyone can think of a way around it.
> In a nutshell I want to query the database to find all tables that have
> a particular field( "comment"), include only results where that field
> has one of 20 substrings in the content, and then print it all out.
> So I have
> (substring1, substring2 substring3 ...substring20)
> and I would like to get output like
> table_name comment substring
> -- -- --
> If I can find another way than using cursors or brute force ( many
> cut-n-pasted tsql statements ) I would be grateful.
> Thanks in advance for any thoughts
> Steve
A strange thing to want to do at runtime. Why don't you know what
columns exist in your database? Sensible data manipulation requirements
against a known, static database schema can indeed be done 99.99% of
the time without using cursors.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
cursors were overused, mostly by programmers who were thinking like
programmers instead of db people.
I have a task to do and I'm not sure I can do it without a cursor.
I'm curious to see if anyone can think of a way around it.
In a nutshell I want to query the database to find all tables that have
a particular field( "comment"), include only results where that field
has one of 20 substrings in the content, and then print it all out.
So I have
(substring1, substring2 substring3 ...substring20)
and I would like to get output like
table_name comment substring
-- -- --
If I can find another way than using cursors or brute force ( many
cut-n-pasted tsql statements ) I would be grateful.
Thanks in advance for any thoughts
SteveWell this sounds like a one of a kind request. If it isn't you have some
serious design flaws. A cursor is useful for something like that where you
need to navigate multiple objects dynamically. What you should not use a
cursor for are things that can get the results via a SET based approach. For
instance you would not create a cursor to navigate each row of the table to
search for yoru string. You would do that in a SET based fashion.
Andrew J. Kelly SQL MVP
"Steve" <stevesusenet@.yahoo.com> wrote in message
news:1139531021.868263.148350@.g47g2000cwa.googlegroups.com...
>A while back a db expert I was talking to expressed the opinion that
> cursors were overused, mostly by programmers who were thinking like
> programmers instead of db people.
> I have a task to do and I'm not sure I can do it without a cursor.
> I'm curious to see if anyone can think of a way around it.
> In a nutshell I want to query the database to find all tables that have
> a particular field( "comment"), include only results where that field
> has one of 20 substrings in the content, and then print it all out.
> So I have
> (substring1, substring2 substring3 ...substring20)
> and I would like to get output like
> table_name comment substring
> -- -- --
> If I can find another way than using cursors or brute force ( many
> cut-n-pasted tsql statements ) I would be grateful.
> Thanks in advance for any thoughts
> Steve
>|||Hello, Steve
Let's take it one step at a time. First, we need a list of tables that
have a column named "comment":
SELECT o.name FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.name='comment'
Then, for each of the above tables, we would want to do something like
this:
SELECT 'Some table' as table_name, comment, sub_string
FROM [Some table] t INNER JOIN (
SELECT 'substring1' sub_string
UNION SELECT 'substring2'
UNION SELECT 'substring3'
/* ... */
) x ON t.comment LIKE '%'+sub_string+'%'
Instead of writing the substrings like above, we can use a temporary
table to store them:
CREATE TABLE #substrings (sub_string varchar(50) PRIMARY KEY)
INSERT INTO #substrings VALUES ('substring1')
INSERT INTO #substrings VALUES ('substring2')
INSERT INTO #substrings VALUES ('substring3')
/* ... */
Now we can generate the SELECT-s for all the tables, using the
following query:
SELECT '
SELECT '''+o.name+''' as table_name, comment, sub_string
FROM ['+o.name+'] t INNER JOIN #substrings x
ON t.comment LIKE ''%''+sub_string+''%''
' FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.name='comment'
After executing the above query, copy the results into another query
window and execute them.
We can stop here, but let's make it more automatic: we can use a WHILE
loop to execute each statement (yes, this resembles a cursor very
much...) that puts the results in a temporary table:
CREATE TABLE #results (table_name sysname, comment ntext, sub_string
varchar(50))
create table #statements (id int identity primary key, sql
nvarchar(4000))
insert into #statements
SELECT '
INSERT INTO #results SELECT '''+o.name+''' as table_name, comment,
sub_string
FROM ['+o.name+'] t INNER JOIN #substrings x
ON t.comment LIKE ''%''+sub_string+''%''
' FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.name='comment'
declare @.id int, @.sql nvarchar(4000)
set @.id=0
while 1=1 begin
set @.id=(select min(id) from #statements where id>@.id)
if @.id is null break
select @.sql=sql from #statements where id=@.id
exec (@.sql)
end
drop table #statements
select * from #results
drop table #results
If you don't like the WHILE loop, we can write something shorter, using
an undocumented stored procedure: sp_execresultset (of course, using
undocumented features is not recommended, but this is a one-time job,
isn't it?)
CREATE TABLE #results (table_name sysname, comment ntext, sub_string
varchar(50))
EXEC sp_execresultset '
SELECT ''
INSERT INTO #results SELECT '''+o.name+''' as table_name,
comment, sub_string
FROM [''+o.name+''] t INNER JOIN #substrings x
ON t.comment LIKE ''''%''''+sub_string+''''%''''
'' FROM syscolumns c INNER JOIN sysobjects o ON c.id=o.id
WHERE o.xtype=''U'' AND c.name=''comment''
'
select * from #results
drop table #results
Razvan|||Thanks for the code Razvan!|||Steve wrote:
> A while back a db expert I was talking to expressed the opinion that
> cursors were overused, mostly by programmers who were thinking like
> programmers instead of db people.
> I have a task to do and I'm not sure I can do it without a cursor.
> I'm curious to see if anyone can think of a way around it.
> In a nutshell I want to query the database to find all tables that have
> a particular field( "comment"), include only results where that field
> has one of 20 substrings in the content, and then print it all out.
> So I have
> (substring1, substring2 substring3 ...substring20)
> and I would like to get output like
> table_name comment substring
> -- -- --
> If I can find another way than using cursors or brute force ( many
> cut-n-pasted tsql statements ) I would be grateful.
> Thanks in advance for any thoughts
> Steve
A strange thing to want to do at runtime. Why don't you know what
columns exist in your database? Sensible data manipulation requirements
against a known, static database schema can indeed be done 99.99% of
the time without using cursors.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
2012年3月11日星期日
Any suggesstions please
I am passing a XML string from client, In the back end I
am verifying the data with constraints of the columns.
Exec sp_xml_preparedocument @.hdoc OUTPUT,@.xml
select * into #tempApps
from openxml(@.hdoc, N'//application',2)
with AP_Applications --This is the physical table
EXEC sp_xml_removedocument @.hdoc
The system will create an ApplicationId at the time of
inserting a new record. Before inserting a record I am
checking the data.
When I run the above code I am getting the following
error.
Unexpected NULL value returned for
column '[OpenXML].AppId' from the OLE DB
provider 'OpenXML'. This column cannot be NULL.
OLE DB error trace [Non-interface error: Unexpected NULL
value returned for the column: ProviderName='OpenXML',
TableName='[OpenXML]', ColumnName='AppId'].
I will appreciate you can give some suggestions.
Thanks in Advance
You cannot use a table name with an identity column in the with clause. You
have to give the with clause (without the Identity column) explicit.
Best regards
Michael
<anonymous@.discussions.microsoft.com> wrote in message
news:784a01c43121$a8d09420$a501280a@.phx.gbl...
>I am passing a XML string from client, In the back end I
> am verifying the data with constraints of the columns.
> Exec sp_xml_preparedocument @.hdoc OUTPUT,@.xml
> select * into #tempApps
> from openxml(@.hdoc, N'//application',2)
> with AP_Applications --This is the physical table
>
>
> EXEC sp_xml_removedocument @.hdoc
>
> The system will create an ApplicationId at the time of
> inserting a new record. Before inserting a record I am
> checking the data.
> When I run the above code I am getting the following
> error.
> Unexpected NULL value returned for
> column '[OpenXML].AppId' from the OLE DB
> provider 'OpenXML'. This column cannot be NULL.
> OLE DB error trace [Non-interface error: Unexpected NULL
> value returned for the column: ProviderName='OpenXML',
> TableName='[OpenXML]', ColumnName='AppId'].
> I will appreciate you can give some suggestions.
>
> Thanks in Advance
>
am verifying the data with constraints of the columns.
Exec sp_xml_preparedocument @.hdoc OUTPUT,@.xml
select * into #tempApps
from openxml(@.hdoc, N'//application',2)
with AP_Applications --This is the physical table
EXEC sp_xml_removedocument @.hdoc
The system will create an ApplicationId at the time of
inserting a new record. Before inserting a record I am
checking the data.
When I run the above code I am getting the following
error.
Unexpected NULL value returned for
column '[OpenXML].AppId' from the OLE DB
provider 'OpenXML'. This column cannot be NULL.
OLE DB error trace [Non-interface error: Unexpected NULL
value returned for the column: ProviderName='OpenXML',
TableName='[OpenXML]', ColumnName='AppId'].
I will appreciate you can give some suggestions.
Thanks in Advance
You cannot use a table name with an identity column in the with clause. You
have to give the with clause (without the Identity column) explicit.
Best regards
Michael
<anonymous@.discussions.microsoft.com> wrote in message
news:784a01c43121$a8d09420$a501280a@.phx.gbl...
>I am passing a XML string from client, In the back end I
> am verifying the data with constraints of the columns.
> Exec sp_xml_preparedocument @.hdoc OUTPUT,@.xml
> select * into #tempApps
> from openxml(@.hdoc, N'//application',2)
> with AP_Applications --This is the physical table
>
>
> EXEC sp_xml_removedocument @.hdoc
>
> The system will create an ApplicationId at the time of
> inserting a new record. Before inserting a record I am
> checking the data.
> When I run the above code I am getting the following
> error.
> Unexpected NULL value returned for
> column '[OpenXML].AppId' from the OLE DB
> provider 'OpenXML'. This column cannot be NULL.
> OLE DB error trace [Non-interface error: Unexpected NULL
> value returned for the column: ProviderName='OpenXML',
> TableName='[OpenXML]', ColumnName='AppId'].
> I will appreciate you can give some suggestions.
>
> Thanks in Advance
>
2012年3月8日星期四
Any report runs once and then I have to log back in to my app
We have an asp.net app that calls the report server for our reports. We are
running into an issue we don't even understand why it's happening let alone
fixing it...
You can only run one report and then you have to logout of the app and log
back in to run another report. This is with any of our reports! They all
work but only the first report runs the first time. After that all of the
reports don't work. Logout and log back in and choose another report and it
works...?
Here's our code that is basically the same for every report...
dstDataSet = New DataSet
Dim strSPName As String = "spSRS_Appeal_TaxAgents"
'Passing the parameter to the SQL stored procedure
Dim aryParams(1) As SqlParameter
aryParams(0) = New SqlClient.SqlParameter("@.TaxYear", SqlDbType.Int)
aryParams(0).Value = CType(strTaxYear, Integer)
aryParams(1) = New SqlClient.SqlParameter("@.Cycle", SqlDbType.Int)
aryParams(1).Value = CType(strCycle, Integer)
Try
dstDataSet = SqlHelper.ExecuteDataset(cnnConn, strSPName,
aryParams)
Dim intCount As Integer = dstDataSet.Tables(0).Rows.Count
If intCount < 1 Then
lblInfo.Text = "Report records not found! Canceled operation."
Exit Sub
End If
Catch exn As Exception
lblInfo.Text = "Error. Failed to retrieve records! " & exn.Message
End Try
'Create the URL string to render this report from the SQL report
server
'SPParam is the parameter which is submitted to the SQL sotred
procedures
Dim str1, str2, str3, str4, strURL As String
str1 = "http://tennessee/reportserver?/astransc/AppealTaxAgents"
str2 = "&rs:Command=Render&rs:Format=PDF"
str3 = strTaxYear
str4 = strCycle
Dim strPath As New System.Text.StringBuilder
strPath.Append(str1)
strPath.Append(str2)
strPath.Append("&TaxYear=").Append(str3)
strPath.Append("&Cycle=").Append(str4)
strURL = strPath.ToString
Response.Redirect(strURL)
The report is in PDF format and when the report runs it pops up a form
asking if we want to open, save, or cancel the PDF file...
The programmer who wrote this doesn't have this issue on his machine.
However, on the test server this is occuring to us. In fact the programmer
asked for assistance because on his machine it on a rare occasion would not
create the PDF file but he couldn't find a cause for it. On our test server
it occurs like clock work. Log in, run one report (any of them) and then no
other report including the one you just called won't work until you log back
in....
In looking at the report server logs the subsequent requests are not even
making it to the report server? Any ideas? We were wondering if there was
something about the response.redirect? I can take the string created by
the code type it into a url address and it works every time?
Thanks,
KevinI have somewhat figured out what is occuring...
The viewstate is being clobbered when this is occuring (not entirely sure
how but suspect it is occuring because the redirect does not physically
change the page I am on, only creates a do you want to open, save, cancel
this PDF file dialog box). I can only assume that the response.redirect is
the cause now. I am going to figure out a way to accomplish this task.
Kevin
"Kevin" wrote:
> We have an asp.net app that calls the report server for our reports. We are
> running into an issue we don't even understand why it's happening let alone
> fixing it...
> You can only run one report and then you have to logout of the app and log
> back in to run another report. This is with any of our reports! They all
> work but only the first report runs the first time. After that all of the
> reports don't work. Logout and log back in and choose another report and it
> works...?
> Here's our code that is basically the same for every report...
> dstDataSet = New DataSet
> Dim strSPName As String = "spSRS_Appeal_TaxAgents"
> 'Passing the parameter to the SQL stored procedure
> Dim aryParams(1) As SqlParameter
> aryParams(0) = New SqlClient.SqlParameter("@.TaxYear", SqlDbType.Int)
> aryParams(0).Value = CType(strTaxYear, Integer)
> aryParams(1) = New SqlClient.SqlParameter("@.Cycle", SqlDbType.Int)
> aryParams(1).Value = CType(strCycle, Integer)
> Try
> dstDataSet = SqlHelper.ExecuteDataset(cnnConn, strSPName,
> aryParams)
> Dim intCount As Integer = dstDataSet.Tables(0).Rows.Count
> If intCount < 1 Then
> lblInfo.Text = "Report records not found! Canceled operation."
> Exit Sub
> End If
> Catch exn As Exception
> lblInfo.Text = "Error. Failed to retrieve records! " & exn.Message
> End Try
> 'Create the URL string to render this report from the SQL report
> server
> 'SPParam is the parameter which is submitted to the SQL sotred
> procedures
> Dim str1, str2, str3, str4, strURL As String
> str1 = "http://tennessee/reportserver?/astransc/AppealTaxAgents"
> str2 = "&rs:Command=Render&rs:Format=PDF"
> str3 = strTaxYear
> str4 = strCycle
> Dim strPath As New System.Text.StringBuilder
> strPath.Append(str1)
> strPath.Append(str2)
> strPath.Append("&TaxYear=").Append(str3)
> strPath.Append("&Cycle=").Append(str4)
> strURL = strPath.ToString
> Response.Redirect(strURL)
> The report is in PDF format and when the report runs it pops up a form
> asking if we want to open, save, or cancel the PDF file...
> The programmer who wrote this doesn't have this issue on his machine.
> However, on the test server this is occuring to us. In fact the programmer
> asked for assistance because on his machine it on a rare occasion would not
> create the PDF file but he couldn't find a cause for it. On our test server
> it occurs like clock work. Log in, run one report (any of them) and then no
> other report including the one you just called won't work until you log back
> in....
> In looking at the report server logs the subsequent requests are not even
> making it to the report server? Any ideas? We were wondering if there was
> something about the response.redirect? I can take the string created by
> the code type it into a url address and it works every time?
> Thanks,
> Kevin
running into an issue we don't even understand why it's happening let alone
fixing it...
You can only run one report and then you have to logout of the app and log
back in to run another report. This is with any of our reports! They all
work but only the first report runs the first time. After that all of the
reports don't work. Logout and log back in and choose another report and it
works...?
Here's our code that is basically the same for every report...
dstDataSet = New DataSet
Dim strSPName As String = "spSRS_Appeal_TaxAgents"
'Passing the parameter to the SQL stored procedure
Dim aryParams(1) As SqlParameter
aryParams(0) = New SqlClient.SqlParameter("@.TaxYear", SqlDbType.Int)
aryParams(0).Value = CType(strTaxYear, Integer)
aryParams(1) = New SqlClient.SqlParameter("@.Cycle", SqlDbType.Int)
aryParams(1).Value = CType(strCycle, Integer)
Try
dstDataSet = SqlHelper.ExecuteDataset(cnnConn, strSPName,
aryParams)
Dim intCount As Integer = dstDataSet.Tables(0).Rows.Count
If intCount < 1 Then
lblInfo.Text = "Report records not found! Canceled operation."
Exit Sub
End If
Catch exn As Exception
lblInfo.Text = "Error. Failed to retrieve records! " & exn.Message
End Try
'Create the URL string to render this report from the SQL report
server
'SPParam is the parameter which is submitted to the SQL sotred
procedures
Dim str1, str2, str3, str4, strURL As String
str1 = "http://tennessee/reportserver?/astransc/AppealTaxAgents"
str2 = "&rs:Command=Render&rs:Format=PDF"
str3 = strTaxYear
str4 = strCycle
Dim strPath As New System.Text.StringBuilder
strPath.Append(str1)
strPath.Append(str2)
strPath.Append("&TaxYear=").Append(str3)
strPath.Append("&Cycle=").Append(str4)
strURL = strPath.ToString
Response.Redirect(strURL)
The report is in PDF format and when the report runs it pops up a form
asking if we want to open, save, or cancel the PDF file...
The programmer who wrote this doesn't have this issue on his machine.
However, on the test server this is occuring to us. In fact the programmer
asked for assistance because on his machine it on a rare occasion would not
create the PDF file but he couldn't find a cause for it. On our test server
it occurs like clock work. Log in, run one report (any of them) and then no
other report including the one you just called won't work until you log back
in....
In looking at the report server logs the subsequent requests are not even
making it to the report server? Any ideas? We were wondering if there was
something about the response.redirect? I can take the string created by
the code type it into a url address and it works every time?
Thanks,
KevinI have somewhat figured out what is occuring...
The viewstate is being clobbered when this is occuring (not entirely sure
how but suspect it is occuring because the redirect does not physically
change the page I am on, only creates a do you want to open, save, cancel
this PDF file dialog box). I can only assume that the response.redirect is
the cause now. I am going to figure out a way to accomplish this task.
Kevin
"Kevin" wrote:
> We have an asp.net app that calls the report server for our reports. We are
> running into an issue we don't even understand why it's happening let alone
> fixing it...
> You can only run one report and then you have to logout of the app and log
> back in to run another report. This is with any of our reports! They all
> work but only the first report runs the first time. After that all of the
> reports don't work. Logout and log back in and choose another report and it
> works...?
> Here's our code that is basically the same for every report...
> dstDataSet = New DataSet
> Dim strSPName As String = "spSRS_Appeal_TaxAgents"
> 'Passing the parameter to the SQL stored procedure
> Dim aryParams(1) As SqlParameter
> aryParams(0) = New SqlClient.SqlParameter("@.TaxYear", SqlDbType.Int)
> aryParams(0).Value = CType(strTaxYear, Integer)
> aryParams(1) = New SqlClient.SqlParameter("@.Cycle", SqlDbType.Int)
> aryParams(1).Value = CType(strCycle, Integer)
> Try
> dstDataSet = SqlHelper.ExecuteDataset(cnnConn, strSPName,
> aryParams)
> Dim intCount As Integer = dstDataSet.Tables(0).Rows.Count
> If intCount < 1 Then
> lblInfo.Text = "Report records not found! Canceled operation."
> Exit Sub
> End If
> Catch exn As Exception
> lblInfo.Text = "Error. Failed to retrieve records! " & exn.Message
> End Try
> 'Create the URL string to render this report from the SQL report
> server
> 'SPParam is the parameter which is submitted to the SQL sotred
> procedures
> Dim str1, str2, str3, str4, strURL As String
> str1 = "http://tennessee/reportserver?/astransc/AppealTaxAgents"
> str2 = "&rs:Command=Render&rs:Format=PDF"
> str3 = strTaxYear
> str4 = strCycle
> Dim strPath As New System.Text.StringBuilder
> strPath.Append(str1)
> strPath.Append(str2)
> strPath.Append("&TaxYear=").Append(str3)
> strPath.Append("&Cycle=").Append(str4)
> strURL = strPath.ToString
> Response.Redirect(strURL)
> The report is in PDF format and when the report runs it pops up a form
> asking if we want to open, save, or cancel the PDF file...
> The programmer who wrote this doesn't have this issue on his machine.
> However, on the test server this is occuring to us. In fact the programmer
> asked for assistance because on his machine it on a rare occasion would not
> create the PDF file but he couldn't find a cause for it. On our test server
> it occurs like clock work. Log in, run one report (any of them) and then no
> other report including the one you just called won't work until you log back
> in....
> In looking at the report server logs the subsequent requests are not even
> making it to the report server? Any ideas? We were wondering if there was
> something about the response.redirect? I can take the string created by
> the code type it into a url address and it works every time?
> Thanks,
> Kevin
订阅:
博文 (Atom)