Hello,
I'm somewhat of a newbie and I need to create a view with a column
that is not derived from any other tables. What I want is for this
field to be an auto-increment field or some kind of UID. Can anyone
quickly tell me how to do this.
Here is my dilemma. I need to pull data from a unique data set from a
table which does not have a primary key, and none exists in its data.
Please tell me how to put this data in a view(or another table) so
that I can pull it out with unique records. It doesnt matter what the
unique field consists of.
Thanks 3 1449
Add newid() to your select statement.
Select newid(),
This will create a UID for each line returned by the select statement. ma******@yahoo. com wrote in message news:<1d******* *************** ****@posting.go ogle.com>... Hello,
I'm somewhat of a newbie and I need to create a view with a column that is not derived from any other tables. What I want is for this field to be an auto-increment field or some kind of UID. Can anyone quickly tell me how to do this.
Here is my dilemma. I need to pull data from a unique data set from a table which does not have a primary key, and none exists in its data. Please tell me how to put this data in a view(or another table) so that I can pull it out with unique records. It doesnt matter what the unique field consists of.
Thanks
> Select newid(), This will create a UID for each line returned by the select statement.
If you do twice the request, the UID wont be the same... So it removes a lot
of the interest of the UID. The best thing to do would ne to add a primary
key to the table...
--
Vincent
(ma******@yahoo .com) writes: I'm somewhat of a newbie and I need to create a view with a column that is not derived from any other tables. What I want is for this field to be an auto-increment field or some kind of UID. Can anyone quickly tell me how to do this.
Here is my dilemma. I need to pull data from a unique data set from a table which does not have a primary key, and none exists in its data. Please tell me how to put this data in a view(or another table) so that I can pull it out with unique records. It doesnt matter what the unique field consists of.
Using newid() as Mike suggested will give you a 16-byte binary value,
which may be somewhat difficult to manage. But it's certainly the
easiest method.
If you want an integer number, the best is probably to write a multi-step
table function where you select the data into a table with an IDENTITY
column, and then return that table.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard Holliingsworth |
last post by:
Hello:
I have an Access 2K form I built from a SQL Server 7.0 view. I want to
lock certain fields in the database from users so they can see them on
the views and forms, but NOT be able to edit them.
I've looked in BOL, MS SQL Server web page and SQL Server 7.0 books and
could not find how to do this.
Any advise will be greatly appreciated.
|
by: billmiami2 |
last post by:
Perhaps many of you MS Access fanatics already know this, but it seems
that stored procedures and views are possible in Jet. I thought I
would leave this message just in case it would help anyone.
I discovered this the other day while doing some experiments with ADO
and ADO.NET. Basically, I wanted to run a stored MS Access query with
parameters using the syntax
Execute MyProcedure @Param1, @Param2...
|
by: davegb |
last post by:
I'm trying to create a self-join table to show the relationship between
employee and supervisor. In another thread, I was advised to create a
SupervisorID in the employee table, a separate Supervisor table, and
join the Supervisor table to the Employee table and a copy of the
Supervisor table to create the self-join. I can't figure out how to do
this from reading Viescas or from researching it here. I can start a
query and create 2 copies...
|
by: bthalapathi |
last post by:
I had a table called 'FruitSaleList', that contains the following columns
sl.no, shop_id, fruitName, price, ....
I had also another table called 'FruitList' that contains the columns
shop_id, fruitName, salesManId, ....
the problem is 'FruitList' table doesn't contain a column like fruitId.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |