Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
H

henry1951

@henry1951
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Retrieving the new defalt value of a uniqueidentifier
    H henry1951

    So, I have one person that hates GUIDS and one that likes them. I chose them for the absolute certainty that there would be no collisions in IDs between tables and / or systems. My main goal was that I wanted to uniquely identify any object in my application. I won't have that many objects that I could not have used integers, but with integers to do that amoung many tables I would have to devise some sort of function that always delivered a new unique one when creating a row in any table. If I could build a suitable function I still might do that. I probably could do so by using a single row table with one tuple holding the last integer used, but I have not tried that yet. One thing I don't understand is why Microsoft created unsigned integers in all its programing languages, but did not provide the same feature in SQL server. I really do not want to use negative values, but the fact that there is no unsigned integer cuts my value pool in half if I choose to start with zero. I also had some Oracle experience and I think I remember the sequence object. I don't know why Microsoft didn't implement something similar. For my part I would like to see sequences that deliver either unique unsigned integers or unique unsigned doubles. That would handle virtually any system that I can think of as a means of generating unique keys I have been taught that SQL Server is much faster when dealing with integer keys because it uses integer arithmatic in its underlying calculations. Is this correct? And if so, how much faster would it be? For now, I have chosen to create the IDs before inserting the rows so I already have them for other purposes. I have tables that serve as links for many to many relationships and that is where I am using the IDs. My next challenge is to figure out how to maintain data for directed acyclic graphs, the idea of being able to show the relationships between any object in the system to any other object in the system even if that realtionship is a remote relationship like a grandparent of a cousin object, etc. I have found one article on Code project regarding that task, but I am looking for more to see if there are other ways to do this and so that I can understand the process better.

    Database database question

  • Retrieving the new defalt value of a uniqueidentifier
    H henry1951

    I created a set of tables in which the primary keys are set to uniqueidentifiers with a default value of newid(), which is the function that generate new guids in Transact-SQL. While I can create a uniqueidentifier variable and initialize it before inserting a row, that would obviate the reason for creating a default value in the first place. But unlike an identity field, there is no function, that I can think of that would retrieve the most recently created uniqueidentifier. I would like to use this value within the body of a stored procedure but I can't think of any way to get it short of creating it ahead of time and not using the default value mechanism. I could access the new value in a trigger, but then how would I pass that back to the stored procedure? I don't think that a trigger is the way to do this, but I don't know. Can anyone show me a way to do this?

    Database database question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups