Rowguid/ Uniqueidentifier

Jun 7, 2007

hi. im new in using rowguid, i want to know how long can this datatype can hold. and is there a chance that value can be duplicate or the sql is checking it already before it create a new one.

and what will happen if i select yes in isrowguid.
thnx

View 2 Replies


ADVERTISEMENT

Usage Of ROWGUID

Feb 27, 2004

Is it a good Practice to use Rowguid for creating unique identifiers within a table

View 1 Replies View Related

T-SQL Create Table Is Rowguid

May 2, 2006

I have the following to create a table in sql server......
CREATE TABLE [dbo].[myTable] (
Id VARCHAR(50) NOT NULL,
fldDate SMALLDATETIME,
guid uniqueidentifier NOT NULL PRIMARY KEY

)
GO
I can't seem to find the right syntax to make the uniqueidentifier a rowguid.
Thanks,
Zath

View 1 Replies View Related

@@identity Equivilant With ROWGUID

Mar 17, 1999

How can I convert this to use GUIDs in SQL 7

Create Procedure sp_sfAddressNameAdd
@AddressName varchar(100)
As

DECLARE @AddressNameID int
INSERT INTO sfAddressName (AddressName)
VALUES (@AddressName)

SELECT @AddressNameID = @@IDENTITY
return @AddressNameID

AddressNameID is set to uniqueidentifier with newid() as default

Thank you,
Craig

View 1 Replies View Related

Invalid Column Name 'rowguid'

Nov 29, 2006

Hi all and I appreciate any help

I recently been assigned to a project that has an ms-access front end and sql server 2000 sp4 as the database engine.
The database was replicated (merge replication) but for some reason they drop replication and when they tried to put it back on they got allot of problems and so they paused it.
My task now is to make it work again. After allot of reading I desided to clean the database and start from the beginning. Using some scripts and instructions on a copy of the database I cleaned all the tables related to merge replication but when I went back to ms-access to update a record I got an error
"invalid column name 'rowguid'" . I checked all my tables in my database but I find not such column as it was dropped using the scripts.
Any ideas that I can use?

Thanks allot,
George

View 1 Replies View Related

Prob With Rowguid Using Newid() Fn

Apr 23, 2006

hi guys

cant find the prob, please help

ALTER TABLE [dbo].[tblUserDetails]
ALTER COLUMN [UserDetailRowGUID] [uniqueidentifier] set default newid()
go

error:Incorrect syntax near the keyword 'default'.

cm

View 2 Replies View Related

Merge Replication Without Rowguid

Jul 20, 2005

hi,I have a database that has Primary Key constraints on every table. Yetwhen I run the replication wizard and try to configure mergereplication the wizard notifies me that it will create a rowguid onthe tables even though they already have a primary key.anybody know how to avoid the rowguid column from being created?regards,Doron

View 1 Replies View Related

Invalid Column Name 'rowguid'

Nov 29, 2006

Hi all,

I'm new to replication and database management so I will like some understanding and guiding as this is a new task for me.

I was given a copy of a database with merge replication on it and doing allot of reading and using some scripts I cleaned replication (or so Im thinking) and tryed to use it again on the ms-access front end. When I try to update some data I get "invalid column name 'rowguid'" , but no such column exist in my database as it was dropped.

Any help on this?

thanks George.

View 10 Replies View Related

Invalid Column Name 'rowguid'

Feb 23, 2007

I'm trying to set up a merge publication in MSSQL 2005 SP1.

I have a database which I have successfully made into a merge publication.  When I run the snapshot agent, several articles are processed successfully, then I encounter an error with the following: Invalid column name 'rowguid'

Note that none of the tables contain 'rowguid' columns before this process - I let MSSQL automatically create these as needed.

The replication monitor details the following error:

Error messages:
·          Message: Invalid column name 'rowguid'.
Command Text: sp_MSpublicationview
Parameters:    @publication = RelMS Publication

Stack:    at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
   at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
   at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
   at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate)
   at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.MakePublicationViews()
   at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()
   at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()
   at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
   at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
   at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: 4615)
Get help: http://help/4615
·          Server [XXXXXXXXXX], Level 16, State 1, Procedure , Line 1
Invalid column name 'rowguid'. (Source: MSSQLServer, Error number: 4615)
Get help: http://help/4615
Can anyone shed further light on this?
Thanks.

View 9 Replies View Related

Undesired ROWGUID Column

Sep 30, 2005

Hello Everyone,

View 4 Replies View Related

Return Autoassigned Rowguid

Jan 16, 2008



Hello,

I've a table with one column specified as rowguid.
An insert into this table is done in a stored procedure, which should return the new rowguid by an output parameter.
How can I obtain the autoassigned rowguid of the inserted record?
is there something like ident_current which is used for identity-columns?

Thanks in advance
Raimund

View 3 Replies View Related

What Is The Usage Of RowGUID Under SQL Server 2005?

Apr 16, 2008

Hi All
What is the usage of Row Guid under SQL Server 2005? It seems not much information state the main purpose of it?
Regards
Alex
 
 

View 21 Replies View Related

Preserve ROWGUID Column During Publication Delete

Apr 30, 2007

Hello,



I am looking to preserve the ROWGUID column that is created automatically when a table is added to a publication as I have noticed that the column is removed and readded (with new values) each time the publication is deleted and recreated. We are planning on using the values in the rowguid column for a non-replication purpose, and don't wish the column to be removed or the values to be reset in the event the 'owning' publication is dropped for whatever reason. I've done some research and have identified the preserve_rowguidcol column of the sysmergearticles table as a candidate for achieving the desired goal. Before moving forward, I wanted to ask for input regarding this. Are there any best practices I've overlooked on this topic? Neither Google nor this forum's search results yield any real discussion on this topic.



Thanks!



DanD

View 7 Replies View Related

After Merge Replication - Wanted To Remove Rowguid Column

Jul 28, 2001

Hi all,

After I setup the merge replication in SQL SERVER 7.0, there is a rowguid column (datatype uniqueidentifier) inserted into each table in the both the source and destination database.

I need to get rid of the rowguid column in all tables. I deleted the replication, but the column still existed.

Is there an easy way to get rid of all the rowguid column in the database? Thanks for your reponse in advanced.

View 2 Replies View Related

Invalid Column Name 'rowguid'. Error When Generating Snapshot For Merge Replication SQL Server 2005

May 15, 2007

Hi there,



I have setup merge replication which successfully synchronizes with a group of desktop users using SQL Compact Edition.



However now I have setup Article Filters and when I attempt to regenerate the snapshot I get the following error:



Invalid column name 'rowguid'.

Failed to generate merge replication stored procedures for article 'AssignedCriteria'.



When I look at publication properties at the Articles page.. All my tables have the rowguid uniqueidentifier successfully added to tables and selected as a compulsory published column, apart from the table above "AssignedCriteria".. Even when I attempt to select this column in the article properties page and press ok, when I come back it is deselected again. ( The Rowguid column is however physically added to the table)



I have scripted the publication SQL and then totally reinstalled from scratch, including the database but for some reason it doesn't like this table. I remove the article filters, but still this "rowguid" is never "selected" in article properties.



We are using Uniqueidentifiers in other columns as well for historical reasons, but this doesn't appear to be a problem in other tables..



DDL For this problematic table is as follows



CREATE TABLE [dbo].[AssignedCriteria](

[AssignedCriteria] [uniqueidentifier] NOT NULL,

[CriteriaName] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

[TargetScore] [numeric](5, 0) NULL,

[HRPlan] [uniqueidentifier] NULL,

[ActualScore] [numeric](18, 0) NULL,

[Criteria] [uniqueidentifier] NULL,

[Employee] [uniqueidentifier] NULL,

[IsActive] [bit] NULL,

[addDate] [datetime] NULL,

[totalscore] [numeric](5, 0) NULL,

[isCalc] [bit] NULL,

[Weight] [decimal](18, 2) NULL,

[ProfileDetail] [uniqueidentifier] NULL,

[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [MSmerge_df_rowguid_7FF25DF903B6415FBFF24AC954BC88E4] DEFAULT (newsequentialid()),

CONSTRAINT [PK_AssignedCriteria] PRIMARY KEY CLUSTERED

(

[AssignedCriteria] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



Thanks.



View 5 Replies View Related

Determine Rowguid In Column And Edit Column Information ASP.NET 1.1 C#

Dec 19, 2006

What query should I run? 
1. To determine whether a column is a rowguid or not using C# .NET 1.1
2. To add/modify column information and be able to set/change:
- Primary key
- Column Name
- Data Type
- Length
- Allow Null
- Default value
- Precision
- Scale
- Identity
- Identity Seed
- Identity Increment
- Row guid
 
Thanks a lot!

View 6 Replies View Related

Uniqueidentifier

Apr 10, 2006

I am really struggling.  I am trying to query a sql database table using a uniqueidentifier. 
Public Class SalesDataClass
Public Function getAccountNumber(ByVal ID As String) As String
Dim accountnumber As String = "0"
'Try
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("InterhealthCRM_MSCRMConnectionString").ConnectionString)
Using command As New SqlCommand("getAccountNumber", connection)
command.CommandType = CommandType.StoredProcedure
 
Dim parameterdat1 As New SqlParameter("@accountid", SqlDbType.UniqueIdentifier)
parameterdat1.Value = ID
command.Parameters.Add(parameterdat1)
Dim parameterdat2 As New SqlParameter("@accountnum", SqlDbType.NVarChar, 20, ParameterDirection.Output)
command.Parameters.Add(parameterdat2)
connection.Open()
command.ExecuteNonQuery()
accountnumber = parameterdat2.Value
Return accountnumber
 
End Using
End Using
'Catch ex As SqlException
' Catch ex As InvalidOperationException
' Catch ex As Exception
' You might want to pass these errors
' back out to the caller.
' End Try
End Function
End Class
Can someone help me correct my code.
 
Sproc:
ALTER PROCEDURE [dbo].[getAccountNumber]
-- Add the parameters for the stored procedure here
@accountId uniqueidentifier,
@accountnum nvarchar(20) output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT accountNumber from accountbase where accountid = @accountid
return @accountnum
END

View 2 Replies View Related

Uniqueidentifier

Jul 17, 2003

Hi,

I am using UNIQUEIDENTIFIER column for my table. I do not insert data for it. I left it on database by setting to default NEWID(). Now in my application I need the value of UNIQUEIDENTIFIER column I just inserted. Is there any function or query to get this value like in case of IDENTITY column we can get the latest inserted value from select @@IDENTITY.

Thanks and regards,
Uday

View 3 Replies View Related

Uniqueidentifier

Jan 28, 2006

Hey I was curious about the Uniqueidentifier is that better then using the @IDENTITY, apparently the Unique uses your computers mac address as a base???

View 4 Replies View Related

Uniqueidentifier

Dec 5, 2006

as above, how can i use this datatype to generate a running number for my userID ? i tried with newid() but it returns a unique 32bit.

View 10 Replies View Related

Uniqueidentifier

Apr 4, 2008



does SQLCE supports the use of uniqueidentifier datatype.and how can i use it?
i have heard that SQLCE supports only integer type as identity column.
so what datatype i should use for identification(primary key).

View 4 Replies View Related

Uniqueidentifier Inner Join Int

Nov 5, 2007

I have a table with id(uniqueidentifier) as the primary key, and another table with id(int) as the foreign key.
When I try to INNER JOIN them on id=id  in a view, I get an error that uniqueidentifier and int are incompatible.
I'm new to SQL SERVER and I consider uniqueidentifier as equal to AutoNumber in MSAccess. Isn't it so? If not, how do I make this JOIN work?

View 3 Replies View Related

Uniqueidentifier And Combobox

Nov 26, 2007

Hello all,
I would like to put another line into my combo box using this SQL statement but this part "(select newid() as QuestionID, 'Select a Question' as QuestionText)" is not working.   (select newid() as QuestionID, 'Select a Question as QuestionText) union all (SELECT * FROM (SELECT TOP 100 * FROM [dbo.aspnet_Questions]) as tbl)
RETURN
It gives me an error: Invalid object name 'dbo.aspnet_Questions'.  Can anybody please help me with this error? 
Thank you, Vic. 

View 5 Replies View Related

Uniqueidentifier URGENT PLEASE!

Jan 26, 2008

I just want to ask if there is a passible explaination for why this code thosen't generate the proper RETURN VALUE, My coal is when a user uses the asp:CreateUserWizard i retrive GUID from the new account.With this I will check if the relation tabel has that value, so I would like to run this.
Stored Proc.
CREATE PROCEDURE proc_CustomerCheckExist@UserId uniqueidentifierASIF EXISTS (SELECT COUNT(*) FROM dbo.aspnet_LD_Customers WHERE UserId = @UserId)    Return 1ELSE    Return 0GO
Problem is if I take 2 different GUID, I still get the same result "Return 1" as true even if I dont have the GUID in my tabel row
Thanks!

View 3 Replies View Related

How Do I Get The Uniqueidentifier Of Just Inserted Row?

Apr 18, 2004

Hello there!

it was a while since i studied SQL and that brings us to my problem...

I'm creating a Stored Procedure wich first insert information in a table. That table has a uniqueidentifier fild that is default-set to newid().

later in the SP i need that uniqueidentifier value? how do I get it?

I tried this:

CREATE PROCEDURE spInsertNews
@uidArticleId uniqueidentifier = newid,
@strHeader nvarchar(300),
@strAbstract nvarchar(600),
@strText nvarchar(4000),
@dtDate datetime,
@dtDateStart datetime,
@dtDateStop datetime,
@strAuthor nvarchar(200),
@strAuthorEmail nvarchar(200),
@strKeywords nvarchar(400),
@strCategoryName nvarchar(200) = 'nyhet'
AS
INSERT INTO tblArticles
VALUES( @uidArticleId,@strHeader,@strAbstract,@strText,@dt
Date,@dtDateStart,@dtDateStop,@strAuthor,@strAutho
rEmail,@strKeywords)

declare @uidCategoryId uniqueidentifier
EXEC spGetCategoryId @strCategoryName, @uidCategoryId OUTPUT

INSERT INTO tblArticleCategory(uidArticleId, uidCategoryId)
VALUES(@uidArticleId, @uidCategoryId)


But i get an error when I EXEC the SP like this:

EXEC spInsertNews
@strHeader = 'Detta är den andra nyheten',
@strAbstract = 'dn första insatt med sp:n',
@strText = 'här kommer hela nyhetstexten att stå. Här får det plats 2000 tecken, dvs fler än vad jag orkar skriva nu...',
@dtDate = '2003-01-01',
@dtDateStart = '2003-01-01',
@dtDateStop = '2004-01-01',
@strAuthor = 'David N',
@strAuthorEmail = 'david@davi.com',
@strKeywords = 'nyhet, blajblaj, blaj'


the errormessage is: Syntax error converting from a character string to uniqueidentifier.


does anyone have a sulution to this problem?
Can I use something similar to the @@IDENTITY?
I will be greatful for any ideas...

thanks
/David, Sweden

View 8 Replies View Related

Ok To Concat A Uniqueidentifier?

Jul 8, 2004

I want to use a NEWID() to generate order numbers, but i dont want to give customers the long uniqueID. so im wondering if i concatinate it to 8 characters, if that would be safe or not...

thx in adv

View 6 Replies View Related

Return A UNIQUEIDENTIFIER

Feb 9, 2005

Hi,

I am writing a C# application that uses a SQL server database to hold its data. I need to create a stored procedure that returns a particular row's primary key value. This is no problem if the primary key is an INT. But my primary key is a unique identifier, and the stored procedure doesn't want to let me return any values that aren't INTs. Can someone please tell me how to get around this?

Thanks in advance.

Scott

View 3 Replies View Related

Problem With SP And Uniqueidentifier

Nov 28, 2005

I am trying to use a stored procedure and it seems to be giving me a error - I think it doesn't like the uniqueidentifier.   I have included the error, stored procedure, and code behind that calls the stored procedure.Thanks for any help on this!  This is the error I get:System.ArgumentException: No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type. at System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen) at System.Data.SqlClient.SqlParameter.GetMetaTypeOnly() at System.Data.SqlClient.SqlParameter.Validate(Int32 index) at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters) at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at view_WardSec_PatientLogDetail2.UpdateRecord_buttonClick(Object sender, EventArgs e) in C:Documents and SettingsKBuchanan.LMHDesktopWebSitesNewest_ERViewsview_WardSec_PatientLogDetail.aspx.vb:line 358 Here is the stored procedure:set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo
ALTER PROCEDURE [dbo].[UpdateTblVisit_WardSecPatientLog]  ( @VID decimal, @lbl_ChiefComplaint nvarchar(50),  @TriageDtTmTextBox datetime,  @PtInRmDtTmTextBox datetime,  @RnInRmDtTmTextBox datetime,  @PhyInRmDtTmTextBox datetime,  @EDHoldDisposDtTmTextBox datetime,  @DispDschDtTmTextBox datetime,  @ddlTriageNurse uniqueidentifier,  @ddlPriNurse uniqueidentifier,  @ddlEDPhy uniqueidentifier,  @ddlPriRefPhy decimal,  @ddlSecRefPhy decimal,  @ddlDschRN uniqueidentifier,  @ddlDschPhy uniqueidentifier,  @ddl_MnsArriv decimal,  @lblDschDiag nvarchar(50),  @chkbox_LogComplete bit )AS
SET NOCOUNT ON
 Update   tblVisit  SET  vChiefComplaint = @lbl_ChiefComplaint,   vTriageDtTm = @TriageDtTmTextBox,   vPtInRmDtTm = @PtInRmDtTmTextBox,   vRnInRmDtTm = @RnInRmDtTmTextBox,   vPhyInRmDtTm = @PhyInRmDtTmTextBox,   vEDHoldDisposDtTm = @EDHoldDisposDtTmTextBox,   vDispDschDtTm = @DispDschDtTmTextBox,   vTriageRnID = @ddlTriageNurse,   vRnID = @ddlPriNurse,   vEdPhyProvID = @ddlEDPhy,   vPriRefPhyProvID = @ddlPriRefPhy,   vSecRefPhyProvID = @ddlSecRefPhy,   vDschRnID = @ddlDschRN,   vDschPhyID = @ddlDschPhy,   vMnsArrvID = @ddl_MnsArriv,   vDschDiag = @lblDschDiag,   vLogCompletedInd = @chkbox_LogComplete,   vLogLastEdit = getDate() WHERE   VID = @VID    SET NOCOUNT OFF RETURN
-----------------------------------------------------------------------------Following is the codebehind for a button oncommand event.  This codeshould execute the stored procedure.-----------------------------------------------------------------------------
    Public Sub UpdateRecord_buttonClick(ByVal sender As Object, ByVal e As System.EventArgs)        'Use this to update the CareGiverID into the tbl_Visit table.        Dim sbSql As New System.Text.StringBuilder        sbSql.Append("EXEC UpdateTblVisit_WardSecPatientLog ")        sbSql.Append("@VID, ")        sbSql.Append("@lbl_ChiefComplaint, ")        sbSql.Append("@TriageDtTmTextBox, ")        sbSql.Append("@PtInRmDtTmTextBox, ")        sbSql.Append("@RnInRmDtTmTextBox, ")        sbSql.Append("@PhyInRmDtTmTextBox, ")        sbSql.Append("@EDHoldDisposDtTmTextBox, ")        sbSql.Append("@DispDschDtTmTextBox, ")        sbSql.Append("@ddlTriageNurse, ")        sbSql.Append("@ddlPriNurse, ")        sbSql.Append("@ddlEDPhy, ")        sbSql.Append("@ddlPriRefPhy, ")        sbSql.Append("@ddlSecRefPhy, ")        sbSql.Append("@ddlDschRN, ")        sbSql.Append("@ddlDschPhy, ")        sbSql.Append("@ddl_MnsArriv, ")        sbSql.Append("@lblDschDiag, ")        sbSql.Append("@chkbox_LogComplete, ")        sbSql.Append("@UserID ")
        'Response.Write(sbSql.ToString)        'Response.End()
        'Create variables for each of the edited values        Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("ERTrekker_ProdConnectionString1").ConnectionString)        Dim cmd As New SqlCommand(sbSql.ToString(), con)
        FindControls(DetailsView, "lbl_ChiefComplaint")        Dim ilbl_ChiefComplaint As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "TriageDtTmTextBox")        Dim iTriageDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "PtInRmDtTmTextBox")        Dim iPtInRmDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "RnInRmDtTmTextBox")        Dim iRnInRmDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "PhyInRmDtTmTextBox")        Dim iPhyInRmDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "EDHoldDisposDtTmTextBox")        Dim iEDHoldDisposDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "DispDschDtTmTextBox")        Dim iDispDschDtTmTextBox As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "ddlTriageNurse")        Dim iddlTriageNurse As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlPriNurse")        Dim iddlPriNurse As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlEDPhy")        Dim iddlEDPhy As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlPriRefPhy")        Dim iddlPriRefPhy As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlDschRN")        Dim iddlDschRN As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddlDschPhy")        Dim iddlDschPhy As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "ddl_MnsArriv")        Dim iddl_MnsArriv As DropDownList = CType(MyControl, DropDownList)        FindControls(DetailsView, "lblDschDiag")        Dim ilblDschDiag As TextBox = CType(MyControl, TextBox)        FindControls(DetailsView, "chkbox_LogComplete")        Dim ichkbox_LogComplete As CheckBox = CType(MyControl, CheckBox)
        'Add all of the parameters to the command        With cmd.Parameters            .AddWithValue("@VID", Request("vID"))            .AddWithValue("@lbl_ChiefComplaint", ilbl_ChiefComplaint.Text.ToString)            .AddWithValue("@TriageDtTmTextBox", iTriageDtTmTextBox.Text.ToString)            .AddWithValue("@PtInRmDtTmTextBox", iPtInRmDtTmTextBox)            .AddWithValue("@RnInRmDtTmTextBox", iRnInRmDtTmTextBox.Text.ToString)            .AddWithValue("@PhyInRmDtTmTextBox", iPhyInRmDtTmTextBox.Text.ToString)            .AddWithValue("@EDHoldDisposDtTmTextBox", iEDHoldDisposDtTmTextBox.Text.ToString)            .AddWithValue("@DispDschDtTmTextBox", iDispDschDtTmTextBox.Text.ToString)            .AddWithValue("@ddlTriageNurse", iddlTriageNurse.SelectedValue.ToString)            .AddWithValue("@ddlPriNurse", iddlPriNurse.SelectedValue.ToString)            .AddWithValue("@ddlEDPhy", iddlEDPhy.SelectedValue.ToString)            .AddWithValue("@ddlPriRefPhy", iddlPriRefPhy.SelectedValue.ToString)            .AddWithValue("@ddlDschRN", iddlDschRN.SelectedValue.ToString)            .AddWithValue("@ddlDschPhy", iddlDschPhy.SelectedValue.ToString)            .AddWithValue("@ddl_MnsArriv", iddl_MnsArriv.SelectedValue.ToString)            .AddWithValue("@lblDschDiag", ilblDschDiag.Text.ToString)            .AddWithValue("@chkbox_LogComplete", ichkbox_LogComplete.Checked.ToString)            .AddWithValue("@UserID", System.Web.HttpContext.Current.Session("UserID"))
        End With
        ' Open the connection and execute the command        Try            con.Open()            If cmd.ExecuteNonQuery() < 1 Then                Throw New System.Exception("The record was not updated")            End If        Catch ex As Exception            System.Web.HttpContext.Current.Response.Write(ex.ToString())        Finally            If Not con Is Nothing AndAlso con.State = System.Data.ConnectionState.Open Then                con.Close()            End If        End Try    End Sub

View 1 Replies View Related

Foreign Key Is An Uniqueidentifier

Nov 10, 2005

Hello everyone.
I have 2 tables in MSSQL Server 2000, Products(idProduct, idProductType, name, quatity) and ProductsType(idProductType, name).

idXXXX are the primery keys and the data type is uniqueidentifier.

In table Products, the collum idProductType is a foreign key refering table ProductsType.

I can insert as many product types as i want without any problems.
Insert INTO ProductsType(name) VALUES('milk')

When inserting products i use the idProductType that was automatacly generated in last insert.
INSERT INTO Products (uuidProductType,name,quantity,)
VALUES ('AD9388A3-CA86-482D-B57F-6FA068E7D405','President Milk 50cl',500)

but i got the following error in SQL Query Analyzer:
Server: Msg 8169, Level 16, State 2, Line 1
Syntax error converting from a character string to uniqueidentifier.

I have searched the forum and i cant find any solution. i need to use uniqueidentifer data types because replication with PDA devices.

Any tips?

Thank you in advance.
Helder

View 5 Replies View Related

Uniqueidentifier As A Primary Key

Feb 18, 2006

Hey can you use the Uniqueidentifier as a primary key or no??

View 4 Replies View Related

Problem With Sp And Uniqueidentifier

Jul 12, 2006

Hi,

I use this procedure to add a record to the db (SQL 2005)
i constantly get this error:

Conversion failed when converting from a character string to uniqueidentifier.

This is the sp:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROC [dbo].[AddBootloader]

@BootName nvarchar(50),
@Version nvarchar(50),
@CSD nvarchar(50),
@CreatorID uniqueidentifier,
@FilePath nvarchar(150),
@FileSize nvarchar(150)


AS
INSERT INTO dbo.EB_Bootloaders

([Bootname]
,[Version]
,[CSD]
,[FilePath]
,[FileSize]
,[CreatorID])


VALUES

(
@BootName,
@Version,
@CSD,
@CreatorID,
@FilePath,
@FileSize)





And this is the table:

USE [Ebdata]
GO
/****** Object: Table [dbo].[EB_Bootloaders] Script Date: 07/12/2006 10:06:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EB_Bootloaders](
[ID] [bigint] IDENTITY(1,3) NOT NULL,
[BootName] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[Version] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[CSD] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[FilePath] [nvarchar](150) COLLATE Latin1_General_CI_AS NULL,
[FileSize] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,
[CreateDate] [datetime] NULL CONSTRAINT [DF_EB_Bootloaders_CreateDate] DEFAULT (getdate()),
[CreatorID] [uniqueidentifier] NOT NULL,
[UpdateDate] [datetime] NULL,
[UpdateUser] [uniqueidentifier] NULL,
CONSTRAINT [PK_EB_Bootloaders_1] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
USE [Ebdata]
GO
ALTER TABLE [dbo].[EB_Bootloaders] WITH NOCHECK ADD CONSTRAINT [FK_EB_Bootloaders_aspnet_Users] FOREIGN KEY([CreatorID])
REFERENCES [dbo].[aspnet_Users] ([UserId])
NOT FOR REPLICATION
GO
ALTER TABLE [dbo].[EB_Bootloaders] WITH NOCHECK ADD CONSTRAINT [FK_EB_Bootloaders_aspnet_Users1] FOREIGN KEY([UpdateUser])
REFERENCES [dbo].[aspnet_Users] ([UserId])
NOT FOR REPLICATION

The funny thing is that i copied the sp code from another which runs perfect,
I insert a Guid from an asp.net page.

Hope someone can help me here because im am stucked!

Cheers Wimmo

View 3 Replies View Related

How Do I Get The Uniqueidentifier Of Just Inserted Row?

Apr 18, 2004

Hello there!

it was a while since i studied SQL and that brings us to my problem...

I'm creating a Stored Procedure wich first insert information in a table. That table has a uniqueidentifier fild that is default-set to newid().

later in the SP i need that uniqueidentifier value? how do I get it?

I tried this:

CREATE PROCEDURE spInsertNews
@uidArticleId uniqueidentifier = newid,
@strHeader nvarchar(300),
@strAbstract nvarchar(600),
@strText nvarchar(4000),
@dtDate datetime,
@dtDateStart datetime,
@dtDateStop datetime,
@strAuthor nvarchar(200),
@strAuthorEmail nvarchar(200),
@strKeywords nvarchar(400),
@strCategoryName nvarchar(200) = 'nyhet'
AS
INSERT INTO tblArticles
VALUES( @uidArticleId,@strHeader,@strAbstract,@strText,@dt Date,@dtDateStart,@dtDateStop,@strAuthor,@strAutho rEmail,@strKeywords)

declare @uidCategoryId uniqueidentifier
EXEC spGetCategoryId @strCategoryName, @uidCategoryId OUTPUT

INSERT INTO tblArticleCategory(uidArticleId, uidCategoryId)
VALUES(@uidArticleId, @uidCategoryId)


But i get an error when I EXEC the SP like this:

EXEC spInsertNews
@strHeader = 'Detta är den andra nyheten',
@strAbstract = 'dn första insatt med sp:n',
@strText = 'här kommer hela nyhetstexten att stå. Här får det plats 2000 tecken, dvs fler än vad jag orkar skriva nu...',
@dtDate = '2003-01-01',
@dtDateStart = '2003-01-01',
@dtDateStop = '2004-01-01',
@strAuthor = 'David N',
@strAuthorEmail = 'david@davi.com',
@strKeywords = 'nyhet, blajblaj, blaj'


the errormessage is: Syntax error converting from a character string to uniqueidentifier.


does anyone have a sulution to this problem?
Can I use something similar to the @@IDENTITY?
I will be greatful for any ideas...

thanks
/David, Sweden

View 1 Replies View Related

ASPNETDB.MDF-uniqueidentifier

Jan 25, 2006

Hi:
I am using the built in securty database from vs2005
I am trying to write an insert trigger that will add a role each time a user is added but I seem to be having difficulty I believe it's with the uniqueidentifier datatype. when I run this trigger via an insert statement I get the following error.
Can anyone set me straight?
========error==============
Cannot insert the value NULL into column 'RoleId', table 'R:AAAPROJECTSASPVS2005MERCERBUCKSAPP_DATAASPNETDB.MDF.dbo.aspnet_UsersInRoles'; column does not allow nulls. INSERT fails.
==================insert statement==========

Declare @NewUserID as uniqueIdentifier
set @NewUserID=newID()
print Cast(@NewUserID as varchar(50))
insert into dbo.aspnet_Users (ApplicationID,UserID,UserName,LoweredUserName,LastActivityDate)
Values('f23f01f0-7ad7-463b-87e2-f3e9141e6426',@NewUserID,'lrchase','lrchase','7/20/2005')
======trigger============================
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER TRIGGER [InsertRole]
ON [dbo].[aspnet_Users]
AFTER INSERT
AS
DECLARE @RoleID uniqueidentifier
DECLARE @UserID uniqueidentifier
Select @UserID=Userid from inserted
Print @UserID
SELECT @RoleID = RoleID
FROM dbo.aspnet_Roles where dbo.aspnet_Roles.LoweredRoleName='user'
Print @RoleID
SET NOCOUNT ON;
Insert Into dbo.aspnet_UsersInRoles
Values(@UserID,@RoleID)

Thanks Len

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved