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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:51:28+00:00 2026-06-16T11:51:28+00:00

Our company runs a MS Access Frontend and SQL Backend, and I’m trying to

  • 0

Our company runs a MS Access Frontend and SQL Backend, and I’m trying to provide a stored procedure for the frontend that would allow it to have access to T-SQL’s IF EXIST, instead of using DCount to improve performance. To do this I need to be able to pass the SELECT statement to the stored procedure, and so far I have the following code:

CREATE PROCEDURE [dbo].IfExists 
@selectStatement varchar(MAX)
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS (@selectStatement)
    RETURN 1
ELSE
    RETURN 0
END
GO

which doesn’t work because it doesn’t like the @selectStatement instead of a hardcoded statement. Not sure how I can do this, any help would be appreciated.

  • 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-06-16T11:51:30+00:00Added an answer on June 16, 2026 at 11:51 am

    You need to use dynamic sql to achieve this

    http://www.mssqltips.com/sqlservertip/1160/execute-dynamic-sql-commands-in-sql-server/

    e.g.:

    DECLARE @DynamicSQl NVARCHAR(MAX), @retVal INT
    
    SET @DynamicSQl = 'select @retVal = 1 from (' + @selectCommand + ') t'
    
    EXEC sp_executesql @DynamicSQl, N'@retVal INT OUTPUT', @retVal output
    
    IF (@retVal = 1)
      RETURN 1
    ELSE
      RETURN 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a server on our company intranet that runs JBoss. I want to
I'm currently rewriting our company's database app, which is an Access-VBA frontend for a
We are developing automation code that runs against multiple different versions of our company's
My company runs a video website. We currently make our content available via streaming,
Our company is offering some trainings and asks us what would we want to
My company has an Enterprise client/server application that runs on Android. I am adding
Our company develops a web application that other companies can license. Typically, our application
The company I work for has an java application that runs on esmertec jbed
I have a windows service that runs 24/7 on one of our servers. It
My employer uses MOSS 2007 for our company intranet. It runs solely on secure

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.