KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

SQL query does not run via host monitor
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    KS-Soft Forum Index -> HostMonitor
View previous topic :: View next topic  
Author Message
unclelude



Joined: 22 Jan 2003
Posts: 20

PostPosted: Tue Feb 18, 2003 2:24 pm    Post subject: Reply with quote

Alex,

I downloaded the file and now I am using HM 3.65

Tried, but same error "Incorrect Syntax near 'emmWirelessType_EwnIDFK' with and without SQLFetch... option.

Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Wed Feb 19, 2003 12:49 pm    Post subject: Reply with quote

I checked code, documentation, and web forums. But now I am out of ideas, I don't know what can be wrong

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Feb 19, 2003 12:59 pm    Post subject: Reply with quote

When trying the ODBC query test on my end, I found that the entire statement had to be on the same line. Unlike in Query Analyzer where you can put parts of the query on seperate lines for easier viewing. I just pasted it into notepad, turned wordwrap off, and made sure it was all on one line.
Back to top
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Wed Feb 19, 2003 1:16 pm    Post subject: Reply with quote

You can use many lines, HostMonitor makes single line anyway (at least latest version).

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
unclelude



Joined: 22 Jan 2003
Posts: 20

PostPosted: Wed Feb 19, 2003 3:14 pm    Post subject: Reply with quote

Hi Alex,

You are correct, HM expects all the code in one line. I tried your suggestion and it worked. I am very greatful for your help.

Thanks,

Adnan
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Wed Feb 19, 2003 4:16 pm    Post subject: Reply with quote

Ok, I found what was wrong. HostMonitor makes one line from multiline query. But HM just removed 0A and 0D characters and did not insert spaces. My testing multiline requests work because I usually use space in first position for any line except first. Very simple error, I just had to look into right place Thanks
Update available at http://www.ks-soft.net/download/hm366.zip

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
unclelude



Joined: 22 Jan 2003
Posts: 20

PostPosted: Thu Feb 20, 2003 10:53 pm    Post subject: Reply with quote

Hi Alex,

I think the code needs a little bit of tweeking. If you have a couple of lines of SQL code in HM, it removes the space between the lines. For example, the code

select * from tbl1
where a = 1

will become
select * from tbl1where a = 1

to test it, enter few lines of code in HM, then do a cut/paste in notepad without word wrap and you will know what I am referring to.

If I have a code that works in other ODBC applications, should it always work in HM as well, or are there some exceptions ? Should the following work in HM ?

declare @counter1 int,@counter2 int
set @counter1 = (select count(*) from tbl1..tblWooWorkorder)
set @counter2 =(select * from openrowset('SQLOLEDB','ServerName';'username';'password',
'SELECT count(*) FROM tbl2.dbo.tblWooWorkorder ') )

if @counter1 = @counter2
begin
print 0
end
else
begin
print 1
end

Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Thu Feb 20, 2003 11:57 pm    Post subject: Reply with quote

>to test it, enter few lines of code in HM, then do a cut/paste in notepad without word wrap and you will know what I am referring to.

Please, check my message above. There is patch available

[i]>Should the following work in HM ?

I don't know, it depends on driver and server. HostMonitor does not care about syntax of the query. It just send ONE statement to ODBC driver and get responce.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
jricha34



Joined: 07 Jul 2002
Posts: 59
Location: USA

PostPosted: Wed Mar 05, 2003 5:37 pm    Post subject: Reply with quote

This is probably late by the ODBC command line test tool for SQL Server is OSQL. It comes with SQL Server.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    KS-Soft Forum Index -> HostMonitor All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index