FAQ Database Discussion Community


Short guid in SQL Server / converting from a character string to uniqueidentifier

sql-server,guid
I need to create a column witch will contain short guid. So I found out something like this: alter table [dbo].[Table] add InC UNIQUEIDENTIFIER not null default LEFT(NEWID(),6) But I get the error: Conversion failed when converting from a character string to uniqueidentifier. I've been trying LEFT(CONVERT(varchar(36),NEWID()),6) and CONVERT(UNIQUEIDENTIFIER,LEFT(CONVERT(varchar(36),NEWID()),6)) But...

MSIEXEC uninstall application using GUID with GUI wizard, but no user interaction

windows-installer,guid,uninstall,msiexec,uninstaller
i know how to uninstall MSI package using msiexec by guid: msiexec /i {ProductCode} This brings up the uninstall wizard of the application and the user has to click next next next.....finish. i want the uninstall wizard to be shown as normal, but the user should not click next next...

Confusion about GUID Partition Table specification

c,guid,disk-partitioning
I am writing software to utilize and manipulate GUID Partition Tables (GPT). I've been using a number of references, but in looking through the UEFI standards document concerning GUID Partition Tables, a number of questions have come up. On page 121 of the specification document, the field SizeOfPartitionEntry says that...

C# model is not supporting sql query because of GUID

c#,sql-server,guid
In database, my user_details table has "UserId (varchar 255)". My model is as following: public Guid UserId { get; set; } public string Email { get; set; } public string Gender { get; set; } The problem is When I querying it by UserId, I am getting invalid cast exception...

Getting friendly device names in python with windows

python,windows,guid
i want to get network interface name using device GUID. i have a answer using "ipconfig /all" with parsing interface name but "ipconfig /all" is very complex... so i want to get like Getting friendly device names in python but this only show usb driver.. i can find the GUID(actually...

Populate DropDownListFor and default value is guid parameter

drop-down-menu,asp.net-mvc-5,guid,html.dropdownlistfor
I have populated a DropDownListFor with all the correct values. I'm passing a Guid parameter, but don't know how to set the default value to that Guid. View <div class="form-group"> @Html.LabelFor(model => model.Parent) @Html.DropDownListFor(model => model.Parent, new SelectList(Model.AllParents, "Id", "Name"), string.Empty, new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.Parent)...

SqlCE 4.0, CodeFirst and GUID keys

c#,sql-server-ce,code-first,guid
I'm using CodeFirst to design my model and I chose GUID as a data type for my primary keys. My classes looks like this: public class AccountMovementPlan { [Key, DatabaseGenerated( System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity )] public Guid AccountMovementPlanID { get; set; } [Required] public Guid UserAccountID { get; set; } [ForeignKey("UserAccountID")] public UserAccount...

Can an RSS guid be considered globally unique?

rss,guid
I need to store new items from multiple RSS feeds in a database. I would like to use the GUID tag of each item to determine, whether it already exists in the database. See the W3C specification: guid stands for globally unique identifier. It's a string that uniquely identifies the...

Combining Characters with Id Field

c#,sql-server,asp.net-mvc,asp.net-mvc-5,guid
I'll create an Issue table in an MVC5 application and I want to use special code for each type of the issues as below: For IT related questions INF-0001, INF-0002, ... For General type of questions GEN-0001, GEN-0002, ... As I use all the issues on the same table, I...

MYSQL: How to update uuid in multiple tables

mysql,sql-update,foreign-keys,hierarchy,guid
I have 2 tables: table1 -UUID Id -CHAR NAME table2 -UUID Id -UUID table1Id (foreign key for table1 Id) -CHAR CHILD_INFO I need to update these 2 tables Ids to new UUID. (For some copy reason) How to do this with one update (1) Change talbe1 Id to new, 2)...

C#: Unhandled Exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

c#,variables,login,guid,scalar
I've looked through the similar questions on this subject and found none that could compare closely enough to my own problem. There are a lot of different ways to trigger the same exception. I'm new to C# and am working on a simple login form which stores user info within...

Python How to Create UUID Based on File Contents

python,python-2.7,guid,uuid
I was looking at the documentation and in the example section, I don't see how to create a UUID based on File Contents. Google did not help me either. I've tried this: >>> import uuid >>> data = open('/media/emmc/DCIM/100ABC06/00059.JPG','rb') >>> contents = data.read() >>> len(contents) 9155 >>> uuid = uuid.UUID(contents)...

Filter Linq with Guid Stored in Session

c#,asp.net-mvc,linq,guid
I am using this code to filter Linq data and it keeps crashing. public ActionResult Index() { var model = db.Tickets .Include(t => t.TicketNotes) .Where(t => t.OpenUserId == Guid.Parse(Session["LogedUserID"] as string)) .OrderBy(t => t.OpenDate) .ToList(); return View(model); } The error I get is: An exception of type 'System.NotSupportedException' occurred in...

How to get user account unique id (GUID) on Windows?

winapi,guid,uniqueidentifier
I would like to obtain a unique identifier (GUID not SID) of Windows account which my application is currently running on. I tried with GetUserNameEx with NameUniqueId as format. It works well on some machines but fails with ERROR_NONE_MAPPED on others (which seems to be a known problem): How do...

ProjectGuid (.csproj), how to generate it correctly?

c#,visual-studio,msbuild,guid,projects-and-solutions
I'm creating an app. to change the namespace of multiple projects (solution), I copy the content to another location, change folder names, replace text in files content (old namespaces with new namespaces), all is OK. The solution has folders(these folders only exist in the solution, in VS) and every folder...

Joins etc. with GUID as Primary Key on SQL Server

sql-server,database-design,primary-key,guid
Looking at this post: [What are the best practices for using a GUID as a primary key, specifically regarding performance? I understand that if I want to use a GUID as the primary key then this should be non-clustered pk and then also create a clustered int unique index (autoinc)....

Passing Browser Tab information at backend?

java,session,tabs,guid,browser-tab
Scenario: We have one analysis which gives different results based on different inputs. So if the user open the same analysis in two different browser tabs, the session variables being common will get overridden and output will be same in both tabs though we want different outputs based on different...

deserialize a list of Guid c#

c#,list,serialization,guid
Can anyone help me to deserialize this xml file into a list of Guid ? <?xml version="1.0" encoding="UTF-8"?> <content> <0>124179e5-82b9-c551-1e88-515ec3bbe4e3</0> <1>5c8246d3-5b9f-16bb-89dc-515ec4674170</1> <2>9d7f4701-81e3-3c90-c743-515ec9580852</2> <3>ea8d97bd-243b-b917-bc15-51764c2b2f34</3> </content> Thanks in advance....

How to generate a GUID string in the same format as Advantage Database Server?

sql,sql-server,guid,advantage-database-server
I have an advantage database V11 in which I currently store a unique identifier which is a GUID string generated 22 characters long using NewIDString('F'). The snippet from the ADS help is as follows :- "F or File – A GUID encoded as a 22-byte string using File and URL...

Convert ObjectGuid from AD to GUID powershell

powershell,guid
I cannot understand why this does not work in PowerShell v4: New-Object -TypeName System.Guid((New-Object -TypeName DirectoryServices.DirectorySearcher -Property @{ Filter = "(&(objectCategory=computer)(name=$env:COMPUTERNAME))" }).FindOne().Properties.Item('objectguid')[0]) when this works in PowerShell v5: [Guid]::New((New-Object -TypeName DirectoryServices.DirectorySearcher -Property @{ Filter = "(&(objectCategory=computer)(name=$env:COMPUTERNAME))" }).FindOne().Properties.Item('ObjectGuid')[0]) But unfortantly the 'New'...

Can't output Guid Hashcode

sql,vb.net,guid,hashcode
I'm trying to use the hashcode of a guid as a random voucher name for a website, and have been trying to write new records to a SQL table with the Hashcode variable but it doesn't work. command.Parameters.Add("@voucherName", SqlDbType.NVarChar) command.Parameters("@voucherName").Value = Guid.NewGuid().GetHashCode() When using that code it just puts a...