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 168393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:26:43+00:00 2026-05-11T12:26:43+00:00

…specifically, the fn_listextendedproperty system function in MSSQL 2005. I have added an Extended Property

  • 0

…specifically, the fn_listextendedproperty system function in MSSQL 2005.

I have added an Extended Property to my database object, named ‘schemaVersion’. In my MSVC application, using ADO, I need to determine if that Extended Property exists and, if it does, return the string value out of it.

Here is the T-SQL code that does what I want. How do I write this in C++/ADO, or otherwise get the job done?

select value as schemaVer from fn_listextendedproperty(default, default, default, default, default, default, default) where name=N'schemaVersion' 

Here’s the code I tried at first. It failed with the error listed below the code:

_CommandPtr cmd; cmd.CreateInstance(__uuidof(Command)); cmd->ActiveConnection = cnn;  cmd->PutCommandText('select value '     'from fn_listextendedproperty(default, default, default, default, default, default, default) '     'where name=N'schemaVersion''); VARIANT varCount; cmd->Execute(NULL, NULL, adCmdText); 

…here are the errors I peeled out of the ADO errors collection. The output is from my little utility function which adds the extra text like the thread ID etc, so ignore that.

(Proc:0x1930, Thread:0x8A0) INFO : ===   1 Provider Error Messages : ======================= (Proc:0x1930, Thread:0x8A0) INFO : [  1]   (-2147217900) 'Incorrect syntax near the keyword 'default'.' (Proc:0x1930, Thread:0x8A0) INFO :         (SQLState = '42000') (Proc:0x1930, Thread:0x8A0) INFO :         (Source = 'Microsoft OLE DB Provider for SQL Server') (Proc:0x1930, Thread:0x8A0) INFO :         (NativeError = 156) (Proc:0x1930, Thread:0x8A0) INFO : ========================================================== 

EDIT: Updated the call according to suggestions. Also changed ‘SELECT value AS schemaVer’ to just ‘SELECT value’.

EDIT: Changed the first parameter of Execute() to NULL per suggestion. This fixed my original problem, and I proceeded to the next. 🙂

  • 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. 2026-05-11T12:26:44+00:00Added an answer on May 11, 2026 at 12:26 pm

    I still have not figured out how to do this directly. To get on with my life, I wrote a stored procedure which called the function:

    set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go   ALTER PROCEDURE [dbo].[mh_getSchemaVersion] @schemaVer VARCHAR(256) OUTPUT AS     select @schemaVer = CAST( (select value from fn_listextendedproperty(default, default, default, default, default, default, default) where name=N'schemaVersion') AS varchar(256) )     return @@ROWCOUNT 

    …and then called thst sproc from my ADO/C++ code:

    _CommandPtr cmd; cmd.CreateInstance(__uuidof(Command)); cmd->ActiveConnection = cnn; cmd->PutCommandText('mh_getSchemaVersion')_l  _variant_t schemaVar; _ParameterPtr schemaVarParam = cmd->CreateParameter('@schemaVer', adVarChar, adParamOutput, 256); cmd->GetParameters()->Append((IDispatch*)schemaVarParam);  cmd->Execute(NULL, NULL, adCmdStoredProc);  std::string v = (const char*)(_bstr_t)schemaVarParam->GetValue();  ver->hasVersion_ = true; 

    …which works, but I didn’t want to have to deploy a new stored procedure.

    So if anyone can come up with a solution to the original problem and show me how to call the system function directly from ADO/C++, I will accept that as the answer. Otherwise I’ll just accept this.

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

Sidebar

Related Questions

I have an element like this: <span class=tool_tip title=The full title>The ful&#8230;</span> This seems
CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('&#8230;')
I have been making a wordpress template. i got stuck at some place... the
I have the following problem: I am given a tree with N apples, for
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a MySQL query: SELECT px.player, px.pos, px.year, px.age, px.gp, px.goals, px.assists ,
what about this one: I want to format the currentTime displayed by a videoPlayer
English is not my native language. I need a software to spellcheck and correct
I am currently running into a problem where an element is coming back from
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

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.