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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:22:02+00:00 2026-06-15T09:22:02+00:00

I have a Table structure as Empid Int, EmpName Nvarchar, Salary Numeric(18,2), DeptNumber I

  • 0

I have a Table structure as

Empid Int,
EmpName Nvarchar,
Salary Numeric(18,2),
DeptNumber

I have Function which take 2 Argument. as :

ALTER Function [dbo].[GetTotalPrice] 
(
@Salary int,
@DeptNumber int
)
RETURNS int
AS
BEGIN
Declare @TotalSalary int
Select @TotalSalary=@Salary+@DeptNumber 
return @TotalSalary
End

And my Query is how should i develop a Stored procedure Which takes
Each salary and DeptNumber in a Stored Procedure and send that to function and calculate a new Salary. i have tried developing several SP, but could not get any possible solution.

ALTER Proc [dbo].[S7] 
AS
BEGIN
Declare @salary int
Declare @DeptNo int
Select EmpId,EmpName, @salary=salary,@DeptNo=DeptNumber,Salary=dbo.GetTotalPrice(@salary,@DeptNo) 
from dbo.EmpInf
end

When i tried executing the above code it give the following error:

A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
  • 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-15T09:22:03+00:00Added an answer on June 15, 2026 at 9:22 am

    You are using the same SELECT to put data in the variables and returning a result set from the Stored Procedure, you can’t do both in the same statement.

    ALTER Proc [dbo].[S7] 
    AS
    BEGIN
    Select EmpId,EmpName, Salary=dbo.GetTotalPrice(salary,DeptNumber) from dbo.EmpInf
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table structure which is basically: Items ID: INT(10) Title: CHAR(255) ItemsWords
I have 3 tables similar to the sctructure below CREATE TABLE [dbo].[EmpBasic]( [EmpID] [int]
I have a table structure like the following: table a: id int name varchar
I have a table structure which looks like as follows In the above table
I have my table structure like: CREATE TABLE test_two_tabel . T1 ( T1_ID INT
I have following table structure: CREATE TABLE pilot_groups ( id INT PK, name VARCHAR(50),
I have a table structure, simplified like so: period_id int suite_id varchar(20) suite_status varchar(50)
i have 3 tables (employee,structure,District) 1_employee table contains empid,workid and actuallwork fks to structid
i have table structure with 3 colums (column1, column2, column3) and i want to
I have table structure: ous.txt 1452 1793 out.txt 36796 14997 ouw.txt 478 4247 3

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.