Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Bizzare sp_makewebtask issue Expand / Collapse
Author
Message
Posted Thursday, December 6, 2007 2:25 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 3, 2008 8:06 AM
Points: 3, Visits: 12
I'm getting a bizzare error when I execute makewebtask. If I execute the bolded commented out @SQL I get the following failure:
Server: Msg 16805, Level 11, State 1, Procedure sp_makewebtask, Line 131
SQL Web Assistant: Could not execute the SQL statement.

But if I use the select statement instead of the stored procedure, it executes perfectly.

A little history, I'm a SA, so thats not the issue. I used the PRINT key word to make sure the stored procedure I'm executing inside @Query actually works, and it does. We also just recently migrated from SQL 2000 to 2005. The stored procedure was created in 2000. Has anyone seen anything like this before?

Working on this bit of code below:

DECLARE @muusid varchar(50)
declare @Reptitle varchar(500)
declare @SQL varchar(1000)

set @muusid = '#CAELS1'
set @SQL = 'select top 10 * from bpcssql.dbo.itemmasternew_bpcs'
--set @SQL = 'execute icg.dbo.SP_MM_ITEMSTATUS ' + '''' + @muusid + ''''

print @SQL
set @Reptitle = 'Mass Maintenance Status Report for ' + ltrim(rtrim(@muusid))

EXECUTE sp_makewebtask
@outputfile = 'y:\ftp\HtmlReports\MM_QUE_#CAELS1.htm'
,@query = @SQL
,@webpagetitle = 'MASS MAINTENANCE'
,@resultstitle = @Reptitle
,@dbname = 'ICG'
Post #430440
Posted Thursday, December 6, 2007 5:44 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 11:55 AM
Points: 12,905, Visits: 32,165
I've got two ideas to look at:
one is related to cross database chaining:
one command points to one database, and the other points to a different one ...which is correct?

set @muusid = '#CAELS1'
set @SQL = 'select top 10 * from bpcssql.dbo.itemmasternew_bpcs'
--set @SQL = 'execute icg.dbo.SP_MM_ITEMSTATUS ' + '''' + @muusid + ''''

the other thing is are you sure the stored procedure has SET NOCOUNT ON at the top?

you can get wierd results like you are describing if the store proc will return results, but doesn't have that command at the top.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #430502
Posted Friday, December 7, 2007 8:26 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 3, 2008 8:06 AM
Points: 3, Visits: 12
I tried both of those methods and they both failed. the Set NoCount On was specified and I called both SQL statements from the same database. What I did find though, was that if I executed a stored procedure that passed no parameters in the @QUERY, then it worked fine, but I tested a few other stored procedures that did require a parameter to be passed and they all failed. Does anyone know why this might be? Was something set up improperly maybe when we migrated to the new server. This procedure was never an issue in 2000.
Thanks!
Post #430720
Posted Friday, December 7, 2007 8:46 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 11:55 AM
Points: 12,905, Visits: 32,165
I'll ask a different way:
when i create a stored procedure, i only want it to get data from the database it exists in.
It is incredibly rare that i create a procedure that gets data from a different database. if the two queries you posted existed int he database "prod", for example, then the OTHER databases "bpcssql" and "icg" must also exist on the same server...i'm betting they do not exist.

the queries you posted as an example referend to database outside of the database the procedure exists in...it might be that you want to change them: ie:
set @SQL = 'select top 10 * from bpcssql.dbo.itemmasternew_bpcs' -->>'select top 10 * from itemmasternew_bpcsand

--set @SQL = 'execute icg.dbo.SP_MM_ITEMSTATUS ' + '''' + @muusid + '''' -->>'execute SP_MM_ITEMSTATUS


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #430739
Posted Friday, December 7, 2007 9:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 3, 2008 8:06 AM
Points: 3, Visits: 12
They are all on the same server, we just ported everything in the same schema to 2005. I already used a select statement with the ICG database and it worked fine. Like I found, it is only when you pass a parameter into the stored procedure you're executing in the @Query statement. It does this no matter which database you're executing against.
Post #430753
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse