I am reading an article, but when I run the code that provides the article, I get an error :
Message 102, Level 15, State1, Line 16 ''. I got the wrong syntax
I double-checked the syntax and the reason for this error could not be found. The code is as follows, formatted by a SQL prompt.
Can anyone help me with it? great thank you.
SELECT es.session_id, es.host_name, es.login_name, er.status, DB_NAME (database_id) AS database name, SUBSTRING (qt.text, (er.statement_start_offset / 2) + 1 , ((Case (case), when ARTAT_and_offset = 1 THIN LAN (converter (NVHAR, QTText)) * 2 ELSE erstatement_andset and- er.statement_startoffset) / 2) + 1) Personal question], qt.text AS [parent query], es.program_name, er.start_time, qp.query_plan, er.wait_type, er.total_elapsed_time, er.cpu_time, er.logical_reads, er.blocking_session_id, er.open_transaction_count, er .last_wait_type, sys.dm_exec_requests from Er.percent_complete Join INNER for AS sys.dm_exec_sessions es es es esess_ id = Er.session_id Apply cross sys.dm_exec_sql_text (er.sql_handle) Apply AS QT cross sys.dm_exec_query_plan (er.plan_handle) qp WHERE es.is_user_process = 1 and es.session_Id not (@@ SPID) by ORDER es.session_id
Edit:
I run an upper query using SSMS 2008 against an SSL Server 2005 database. When I try to use SSMS 2005, run the same query against the SQL Server 2005 database, everything works just fine as I know, SSMS 2008 can connect to SQL Server 2005 database and work on it Can you do it? Apart from this I tried another example, listed below. This is really simple, similarly, when using SSMS 2005 against SQL Server 2005, it is executed successfully. When using SSMS 2008 against SQL Server 2005, it returns the same error as I mentioned.
SELECT stat.sql_handle, sqltext Anyone have any idea on this?
Thanks
Edit 2:
Just tried to use SSMS 2008 against SQL Server 2008.
You say that you are connecting to "SQL Server 2005 database" Is the server?
I am able to reproduce my problem when using SQL Server 2008 SSMS on SQL Server 2008 Server. This happens when my database compatibility level for the current database is SQL Server 2000, which does not have the attempts you are attempting when I switch the database, then the command works.
Check the compatibility level for your database if it will work in SQL Server 2005 or later.
Comments
Post a Comment