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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:44:03+00:00 2026-05-24T05:44:03+00:00

ALTER function [dbo].[getEmployeeID](@ID int) returns table as begin return ( select * from [dbo].[gtEmployeeName](2)

  • 0
ALTER function [dbo].[getEmployeeID](@ID int) returns table
as  
  begin
  return (
    select * from [dbo].[gtEmployeeName](2)
    select * from Employees where EmployeeID = @ID)
end

here [dbo].[gtEmployeeName] is an other function that I am trying to call.

I am getting an error, can we call or is there any syntax problem?

Msg 156, Level 15, State 1, Procedure getEmployeeID, Line 6
Incorrect syntax near the keyword ‘select’.
Msg 102, Level 15, State 1, Procedure getEmployeeID, Line 6
Incorrect syntax near ‘)’.

Thanks
Prince

  • 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-24T05:44:04+00:00Added an answer on May 24, 2026 at 5:44 am

    If [dbo].[gtEmployeeName] returns scalar you probably are looking for

    ALTER function [dbo].[getEmployeeID](@ID int) returns table
    as  
    begin
    return (
        select *, [dbo].[gtEmployeeName](2) as EmpName from Employees where EmployeeID=@ID)
    end
    

    If [dbo].[gtEmployeeName] returns table you probably are looking for

    ALTER function [dbo].[getEmployeeID](@ID int) returns table
    as  
    begin
    return (
        select * from [dbo].[gtEmployeeName](2) EN
        inner join Employees E on EN.EmployeeID = E.EmployeeID
        where EmployeeID=@ID)
    end
    

    Update the join to outer if that is what you need. Also update the join condition (the example assumes that the returned table from gtEmployeeName has a column EmployeeID and that can be used for joining to Employees.

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

Sidebar

Related Questions

I have the following recursive function: ALTER FUNCTION [dbo].[ListAncestors] ( @Id int ) RETURNS
if I have a function ALTER FUNCTION [dbo].[GetCycleDate] ( ) RETURNS DATE AS BEGIN
This table valued function compiles ok, alter function [dbo].[ftsls031nnnHades](@withExpiredEntries smallint ) returns @t table(
I have a Scalar-valued function in my DB: ALTER FUNCTION [dbo].[fx_fooFunct] (@MyParam varchar(max)) RETURNS
I have a Function like this; ALTER FUNCTION [dbo].[fngcodeme] ( @HESAP INT, @DOV INT,
I have a SQL Function like this; ALTER FUNCTION [dbo].[fngcodeme] ( @HESAP INT, @DOV
I have the following tsql function: ALTER FUNCTION [dbo].[fn_MyFunc] ( @AccountId varchar(50) ) returns
HERE IS THE FUNCTION: ALTER FUNCTION dbo.FN_GET_QUARTER -- the parameters for the function here
When the function is defined like this it will return the correct rows. ALTER
The code ALTER PROCEDURE [dbo].[spSocial.QuestionsAddNew] @IdUser int, @IdQuestionCategory int, @Title int, @Body int, @CreatedDate

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.