MSSQL Error

aabadi's profile image aabadi posted 13 years ago in Creating a connection Permalink
Since you've starting with the MSSQL connection support Ive tried to start using it.
It is working, but in my case every time connect to the database I receive the following error message:
"SQL Error(208): El nombre de objecto 'sys.sysprocesses' no es valido.
(In english... the object name 'sys.sysprocesses' is not valid)

Eventhough that it let me in and run my queries, but Im not able to see the tables, and views.

Thanks in advance
Ariel
ansgar's profile image ansgar posted 13 years ago Permalink
Server version? How to get the current thread id on your server?

I think many of these system views are available only on MSSQL 2005 or even 2008. I'm quite unfamiliar with SQL Server so please point me in the right direction if you have an alternative.
[expired user #5768]'s profile image [expired user #5768] posted 13 years ago Permalink
I've got the same error - with the SQL Server Management Studio 2005 it works... as exptected. :D

SQL Error (208): Ungültiger Objektname 'sys.sysprocesses'.


MSSQL
Version: 8.00.2039
Name: SQL Server 2000 Service Pack 4 (SP4)
ansgar's profile image ansgar posted 13 years ago Permalink
Some idea how to get the thread id on a 2005 server?
[expired user #5768]'s profile image [expired user #5768] posted 13 years ago Permalink
Just to ensure, it is a SQL Server 2000 SP4, but i manage it with the SQL 2005 Management Studio

In this SQL2000 Server the table is called dbo.sysprocesses but it should have a spid and kpid (windows thread).


MSDN Reference on sys.sysprocesses:
http://msdn.microsoft.com/de-de/library/ms179881(v=SQL.90).aspx
ansgar's profile image ansgar posted 13 years ago Permalink
So the query should look like this on old servers, right?
SELECT spid FROM dbo.sysprocesses ...
[expired user #5768]'s profile image [expired user #5768] posted 13 years ago Permalink
Yep, sorry I could have checked this already. But it's friday so my helpfulness is pretty limited. wink

This works like a charm:
SELECT DATEDIFF(SECOND, "login_time", CURRENT_TIMESTAMP) FROM "dbo"."sysprocesses" WHERE "spid"=1;
ansgar's profile image ansgar posted 13 years ago Permalink
Super, that definitely helps out. Will put that as a version-specific query into the connection layer.
Code modification/commit from ansgar.becker, 13 years ago, revision 6.0.0.3888
Fetch uptime on MS SQL backward compatible. See http://www.heidisql.com/forum.php?t=8147
ansgar's profile image ansgar posted 13 years ago Permalink
I noticed that dbo.sysprocesses is also available on a 2008 server, while I'm unsure if I recall right that was deprecated for some reason. For now r3888 always uses dbo instead of sys here.
roxwal's profile image roxwal posted 13 years ago Permalink
for sql2000 can change:

SELECT "name" FROM "sys"."databases" ORDER BY "name";
/* SQL Error (208): Invalid object name 'sys.databases'. */

in

SELECT CATALOG_NAME
FROM INFORMATION_SCHEMA.SCHEMATA
ORDER BY CATALOG_NAME


tks W:-}
ansgar's profile image ansgar posted 13 years ago Permalink
Hm, on a 2008 server this returns 13 times "master". Is that normal and does it return only appropriate rows on a 2k server?
roxwal's profile image roxwal posted 13 years ago Permalink
in my "ms sql 2000" have one line for DB
you can use so

SELECT distinct CATALOG_NAME
FROM INFORMATION_SCHEMA.SCHEMATA
ORDER BY CATALOG_NAME

some detail:
http://databases.aspfaq.com/schema-tutorials/schema-how-do-i-list-the-databases-on-my-server.html

W:-}

Please login to leave a reply, or register at first.