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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:05:51+00:00 2026-06-18T09:05:51+00:00

I need to take the data from a table in the Database, in my

  • 0

I need to take the data from a table in the Database, in my case dbo.EventsCollage and create a View for it.

The View should contain all the records for table to which is based plus I should add a Column called Id of datatype uniqueidentifier.

A uniqueidentifier value (random generated) should be created automatically for every records display in the View

Here how I am creating the View

CREATE VIEW testView
AS
SELECT
x.Name
FROM dbo.EventsCollage as x;

Could you please point me out a sample of code?

  • 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-18T09:05:52+00:00Added an answer on June 18, 2026 at 9:05 am

    Use newId() . (Note: this will give you a new Id for each row each time you select)

    CREATE VIEW testView
    AS
    SELECT
    newId() Id, x.Name
    FROM dbo.EventsCollage as x;
    

    (DEMO – 1)

    Or if you need each row having same uniqueidentifier everytime, try (Note: this will work only up to 100mil records)

    CREATE VIEW testView
    AS
    
    SELECT convert(uniqueidentifier,
           stuff('62799568-6EF2-4C95-84E7-4953A6959C99',1,len(rn),convert(varchar,rn))) id,
           T.Name
    FROM ( 
      select x.Name,  ROW_NUMBER() over (order by x.Name) rn
    FROM dbo.EventsCollage as x ) T;
    

    (DEMO – 2)

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

Sidebar

Related Questions

I need to take some data from one table (and expand some XML on
I'm creating a caching system to take data from an SQLite database table using
I need to update some data from another table.. I want to simply take
I need to take the data I get from an element id pulled from
In a project, I need to extract data from a Visual FoxPro database, which
I have a task to do, I need to take data that has been
i need to take some row. They came from sql TARIH (sql column) is
I need to take rows from two separate tables, and arrange them in descending
i am adding data from vba excel using adodb into a mysql database everything
I need to take an input (date) from a form in a php file,

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.