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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:05:35+00:00 2026-06-13T01:05:35+00:00

I am relatively very new to SQL queries but I have this stored procedure

  • 0

I am relatively very new to SQL queries but I have this stored procedure where I am trying to get value of a declared variable as mentioned below but getting error,

First line is 20 here,

declare @m_ID_v int
set @m_ID_v = ( select ID_C from M_T where MName_C = @MName_parameter)

declare @g bit
if (select G_L_Column from G_L_table Where M_ID_Column = @M_ID_variable)
    set @g_v = 1
else
    set @g_variable = 0

Exception I get:

Msg 4145, Level 15, State 1, Procedure GetID, Line 20
An expression of non-boolean type specified in a context where a
condition is expected, near ‘set’. Msg 156, Level 15, State 1,
Procedure GetID, Line 21 Incorrect syntax near the keyword ‘else’.

Now if I remove declare @g... and try to parse it, no error occurs

EDIT

I want my code to check for returned value by my select statement so “if exists” is not really what am looking for, sorry.

  • 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-13T01:05:36+00:00Added an answer on June 13, 2026 at 1:05 am
    declare @m_ID_v int
    set @m_ID_v = ( select ID_C from M_T where MName_C = @MName_parameter)
    
    declare @g bit
    if ((select G_L_Column from G_L_table Where M_ID_Column = @M_ID_variable) = value )
        set @g_v = 1
    else
        set @g_variable = 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to programming and trying get a (very) long list of information
I'm relatively new to the Python world, but this seems very straight forward. Google
Im relatively new to the Android world but I have a quick question. I
I am relatively very new in image processing and have a mammoth task at
I'm very new to joins, so far I've been doing relatively simple joins but
I am relatively new to socket programming so this may sound like a very
This is probably a very easy question. Hey I'm a student and relatively new
I'm relatively new to python and know very little syntax, but I'm willing to
I'm relatively new to PHP and have exhausted the internet trying to find an
I am relatively new to MySQL and PHP and I have been trying to

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.