Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:40:02+00:00 2026-05-17T01:40:02+00:00

I’m reading an article from this website , but when i run the code

  • 0

I’m reading an article from this website, but when i run the code that article provided, i get the error:

Msg 102, Level 15, State 1, Line 16
Incorrect syntax near '.'.

I double checked the syntax and can’t find the cause of this error. The code is as follows, formatted by SQL Prompt.

Anybody can help me with it? Great thanks.

SELECT  es.session_id ,
        es.host_name ,
        es.login_name ,
        er.status ,
        DB_NAME(database_id) AS DatabaseName ,
        SUBSTRING(qt.text, ( er.statement_start_offset / 2 ) + 1, ( ( CASE WHEN er.statement_end_offset = -1 THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2
                                                                           ELSE er.statement_end_offset
                                                                      END - er.statement_start_offset ) / 2 ) + 1) AS [Individual Query] ,
        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 ,
        er.percent_complete
FROM    sys.dm_exec_requests AS er
        INNER JOIN sys.dm_exec_sessions AS es ON es.session_id = er.session_id
        CROSS APPLY sys.dm_exec_sql_text(er.sql_handle) AS qt
        CROSS APPLY sys.dm_exec_query_plan(er.plan_handle) qp
WHERE   es.is_user_process = 1
        AND es.session_Id NOT IN ( @@SPID )
ORDER BY es.session_id

Edit:

I run the upper query using SSMS 2008 against a SQL Server 2005 database. When I try to use SSMS 2005 run the same query against a SQL Server 2005 database, everything works fine. As i know, SSMS 2008 can connect to a SQL Server 2005 database and operate on it, right? Also I tried another example, listed below. It’s really simple one. Similarly, it execute successfully when using SSMS 2005 against SQL Server 2005. When using SSMS 2008 against SQL Server 2005, it give the same error as i mentioned early.

SELECT  stat.sql_handle ,
        sqltext.text SQL
FROM    sys.dm_exec_query_stats stat
        CROSS APPLY sys.dm_exec_sql_text(stat.sql_handle) sqltext

Anybody have some idea on this?

Thanks.


Edit 2:

Just tried, using SSMS 2008 against SQL Server 2008 works fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:40:03+00:00Added an answer on May 17, 2026 at 1:40 am

    You say that you’re connecting to a “SQL Server 2005 database” a couple of times. Does that mean a SQL Server 2005 server?

    I am able to reproduce your problem when I use SQL Server 2008 SSMS on SQL Server 2008 server. This occurs when my database compatibility level for the current database is SQL Server 2000, which doesn’t have the features you’re trying. When I switch the database the command works.

    Check the compatibility level for your database. The command will work if SQL Server 2005 or later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.