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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:41:00+00:00 2026-05-23T16:41:00+00:00

I am using SQL Server 2008 with GUIDs in all my tables and using

  • 0

I am using SQL Server 2008 with GUIDs in all my tables and using some stored procedures. I want to know if there is a way to output the current GUID that you are updating to?

I know there is the codes below that I use in other procedures:

output inserted.*
output deleted.*

However, I have a case that is an if null insert, else, update. I would like to know which GUID was used in each case. I have heard another way where you create another table, set the value in the table to that the just updated GUID and then SELECT the value from the newly created table, but that just seems extremely redundant and unnecessary. Any workarounds?

Thanks!

  • 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-23T16:41:00+00:00Added an answer on May 23, 2026 at 4:41 pm

    Do you have newid() as the default for the column or are you generating a guid in your code when you do insert/update?

    If you have a default on it of NewID() then there isn’t a way to grab the last inserted/updated one, had it been identity you could have used @@IDENTITY to get the last inserted ID.

    Only way I can think of to do what you want is to take the default off the column, generate a NewID() in your code for insert and remember what that was.

    (This answer was made with the assumption you’re using GUIDS as PK’s)

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

Sidebar

Related Questions

I'm trying to setup the Entity Framework with SQL Server 2008. I'm using Guids
I am using SQL Server 2008 Enterprise. I want to add an identity column
im using sql server 2008. my scenario is as follows. there is a user
Using SQL Server 2008 (R2). I have two tables in different databases (with same
I'm using SQL Server 2008 Express All of the select statments are fine. Now
I'm using SQL Server 2008 with Advanced Services on my Vista Home Premium. I'd
I'm using SQL Server 2008 Management studio viewing a 2005 server and have just
I'm using SQL Server 2008. My database is almost 2GB in size. 90% of
Like: insert into table (col) values (N'multilingual unicode strings') I'm using SQL Server 2008
I am using SQL Server Reporting Services 2008 (though this seems to be an

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.