Error Message This Record Has Been Allocated Elsewhere
Dec 6, 2007
Hi i get an error whenever i try to insert some data into my database, the error basically says that the record has been inserted elsewhere, this might be from the way my code has been formed, can you see any mistakes in my code below; 1 --This stored procedure allocates serial numbers to a rep.
2 --Allocating by taking the Rep_ID as the search criteria input values as input parameters
3 --and start and end range of serial numbers.
4
5 CREATE PROCEDURE wc_Stock_Allocate_Update @Start_RangeID int, @End_RangeID int, @Rep_ID int, @IsAllocate bit, @ROWCOUNT int out , @TotalRequestedCards int out ,@Product_ID int , @OutputMsg varchar(200) out
6
7 AS
8 --BEGIN TRANSACTION
9
10 DECLARE @Start_Range_ID int
11 DECLARE @End_Range_ID int
12
13 SELECT @Start_Range_ID = Serial_ID FROM tblSerial WHERE Serial_No=@Start_RangeID AND Product_ID=@Product_ID
14 if IsNull(@Start_Range_ID,0)<1
15 begin
16 set @OutputMsg = 'Invalid Start Serial No'
17 return
18 end
19 SELECT @End_Range_ID = Serial_ID FROM tblSerial WHERE Serial_No=@End_RangeID AND Product_ID=@Product_ID
20 if IsNull(@Start_Range_ID,0)<1
21 begin
22 set @OutputMsg = 'Invalid End Serial No'
23 return
24 end
25
26 DECLARE @strSQL varchar(5000)
27 DECLARE @ThereIsCriteria bit
28 --DECLARE @TotalRequestedCards int
29
30 SET @ThereIsCriteria =0
31 --SET @TotalRequestedCards = (@End_RangeID - @Start_RangeID)+1
32 DECLARE @RangeDifference INT
33 DECLARE @TotalAlreadyAllocated int
34 SELECT @RangeDifference = COUNT(*) FROM tblSerial WHERE Serial_ID >=@Start_Range_ID AND Serial_ID <= @End_Range_ID
35 SELECT @TotalAlreadyAllocated = COUNT(*) FROM tblSerial WHERE Serial_No >=@Start_RangeID AND Serial_No <= @End_RangeID AND (isnull(Rep_ID,0)>0)
36 --SET @TotalRequestedCards = @RangeDifference - @TotalAlreadyAllocated
37 --if @IsAllocate=0
38 SET @TotalRequestedCards =@RangeDifference
39 IF @IsAllocate = 1
40 BEGIN
41 SET @strSQL = 'UPDATE tblSerial SET Rep_ID=' + LTRIM(RTRIM(CONVERT(CHAR(10),@Rep_ID))) +
42 ', Allocation_Date=GetDate() WHERE Serial_No BETWEEN ' + LTRIM(RTRIM(CONVERT(CHAR(10), @Start_RangeID ))) + ' AND ' + LTRIM(RTRIM(CONVERT(CHAR(10), @End_RangeID ))) + ' AND (tblSerial.Rep_ID=0 OR tblSerial.Rep_ID IS NULL) AND Product_ID=' + ltrim(rtrim(convert(varchar,@Product_ID)))
43
44 END
45 ELSE
46 BEGIN
47 SET @strSQL = 'UPDATE tblSerial SET Rep_ID=0
48 , Allocation_Date= ' + CHAR(39) + '1/1/1999' + CHAR(39) + ' WHERE Serial_No BETWEEN ' + LTRIM(RTRIM(CONVERT(CHAR(10), @Start_RangeID ))) + ' AND ' + LTRIM(RTRIM(CONVERT(CHAR(10), @End_RangeID ))) + ' AND (tblSerial.Rep_ID='+ ltrim(RTRIM(CONVERT(CHAR(10),@Rep_ID))) + ') AND Product_ID=' + ltrim(rtrim(convert(varchar,@Product_ID)))
49
50
51 END
52
53
54 exec (@strSQL)
55 SET @ROWCOUNT = @@ROWCOUNT
56
57 --Make sure this has saved, if not return 10 as this is unexpected error
58
59 IF @ROWCOUNT<1
60 BEGIN
61 RETURN @@error
62 END
63 ELSE
64
65 BEGIN
66
67 print @Start_RangeID
68 DECLARE @Tstamp timestamp
69 DECLARE @Stock_ID int
70
71 IF @IsAllocate = 1
72 BEGIN
73
74 declare @Stock_IDpass int
75 declare @StockSTatus_IDpass int
76 declare @ToRep_IDpass int
77 declare @Start_Range_IDpass int
78 declare @End_Range_IDpass int
79 declare @Product_IDpass int
80
81 set @Stock_IDpass =0
82 set @StockStatus_IDpass =2
83
84 set @ToRep_IDpass = @Rep_ID
85 set @Start_Range_IDpass = @Start_RangeID
86 set @End_Range_IDpass = @End_RangeID
87 set @Product_IDpass = @Product_ID
88
89
90 exec wc_Stock_Update 0,2,@Rep_ID, @Start_RangeID, @End_RangeID, @Product_ID,0
91
92 END
93 ELSE
94 BEGIN
95 DECLARE @Start_Serial_No int ,@End_Serial_No int
96 SELECT @Start_Serial_No =Serial_No FROM tblSerial WHERE Serial_ID=@Start_RangeID
97 SELECT @End_Serial_No =Serial_No FROM tblSerial WHERE Serial_ID=@End_RangeID
98
99 exec wc_Stock_Update 0,2,0, @Start_RangeID, @End_RangeID, @Product_ID,1
100
101 END
102
103 END
104
105 GO
View 1 Replies
ADVERTISEMENT
May 25, 2007
hi all,
i want to show a message when no rows is being returned from the data set,
i.e when there is no data to display the report should display
"No Record Found"
View 3 Replies
View Related
Dec 21, 2005
I am duplicating a record from my asp.net page in to the database. When i click on save I am getting the following error message
Violation of PRIMARY KEY constraint 'PK_clientinfo'. Cannot insert duplicate key in object 'clientinfo'. The statement has been terminated.
The above message i am getting since i have tried to duplicate the clientname field of my table which is set as the primary key.
What i want is instead of this message in the browser i need to display an alert saying "the clientname entered already exists" by checking the value from the database.
Here is my code. pls modify it to achieve the said problem
if(Page.IsValid==true) { conn.Open(); SqlCommand cmd = new SqlCommand("insert into clientinfo (client_name, address) values ('"+txtclientname.Text+"', '"+txtaddress.Text+"')", conn); cmd.ExecuteNonQuery(); conn.Close(); BindData(); txtclear(); System.Web.HttpContext.Current.Response.Write("<script>alert('New Record Added!');</script>"); Response.Redirect("Clientinfo.aspx"); }
View 1 Replies
View Related
Sep 7, 2007
Hi -
I have an File System Task that copies a file from one directory ot another. When I hard code the target directory (c:dirfile.txt) it works fine. When I change it to a virtual directory (\serverdirfile.txt) I get a security error:
[File System Task] Error: An error occurred with the following error message: "Access to the path '\gracehbtest oS2TMM_Live_Title_000002.xml' is denied.".
Where do I change the security settings?
Thanks - Grace
View 5 Replies
View Related
Oct 1, 2001
Hi,
While backing up our database, I am getting the following message:
Could not insert a backup or restore history/detail record in msdb.dbo.sysbackuphistory or sysrestorehistory. This may indicate a problem with the MSDB database. DUMP/LOAD was still successful. (Message 3009)
Does anybody have any resolution for the same ?
Thanks,
Rajan
View 2 Replies
View Related
Aug 18, 2006
I'm trying to use an XML Task to do a simple XSLT operation, but it fails with this error message:
[XML Task] Error: An error occurred with the following error message: "There are multiple root elements. Line 5, position 2.".
The source XML file validates fine and I've successfully used it as the XML Source in a data flow task to load some SQL Server tables. It has very few line breaks, so the first 5 lines are pretty long: almost 4000 characters, including 34 start-tags, 19 end-tags, and 2 empty element tags. Here's the very beginning of it:
<?xml version="1.0" encoding="UTF-8"?>
<ESDU releaselevel="2006-02" createdate="26 May 2006"><package id="1" title="_standard" shorttitle="_standard" filename="pk_stan" supplementdate="01/05/2005" supplementlevel="1"><abstract><![CDATA[This package contains the standard ESDU Series.]]></abstract>
There is only 1 ESDU root element and only 1 package element.
Of course, the XSLT stylesheet is also an XML document in its own right. I specify it directly in the XML Task:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:template name="identity" match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="kw">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="ihs_cats_seq" select="position()"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Its 5th line is the first xsl:template element.
What is going on here? I do not see multiple root elements in either the XML document or the XSLT stylesheet.
Thanks!
View 5 Replies
View Related
May 22, 2007
I am getting an error message when I try to print using reporting services: "an error occurred during printing (0x80004005)"
View 4 Replies
View Related
Nov 20, 2006
My apologies...I wasn't for sure where to post an error like this...
Over the last 2 months I have gotten this SQL Server error (twice). All existing processes will continue to work, however no new processes can be created and users cannot connect to the server. This is the exact text of the message in the SQL Server error log.
Operating system error 10038: An operation was attempted on something that is not a socket...
Error: 17059, Severity: 18, State: 0
Error accepting connection request via Net-Library 'SSNETLIB'. Execution continuing.
Error: 17882, Severity: 18, State:
While we can typically just stop SQL Server Service and restart the services...I have found it is best to restart the machine during non-production times to take care of any 'residual' effects of this error.
The SQL Server 2000 SP4 box with Windows 2003 Standard SP1 is well maintained by our I.T. team and it typically will run 4 or 5 months without a reboot.
Thank you...
...cordell...
View 5 Replies
View Related
Feb 5, 2006
Hi, I have developed a website in asp.net 2. I have tester it and it is working fine on my computer but when I have uploaded it to my server I'm getting an error message when the user signup. The error occurs when I'm setting the user role to 'members'.
Error line > Roles.AddUserToRole(user.UserName, "members")
The strage thig is that it is working on my computer but not on the server. My home computer and the server are running the same software versions and the website database is the same as well.
To double check that my code is not generating the error I have lonched 'SQL Query Analizer' and executed the folowing code on my database:
NOTE: In my database I have create the user “teeluk12� and a role “members�
aspnet_UsersInRoles_AddUsersToRoles "/", "teeluk12", "members", "5/02/2006 4:44:33 pm"
Once again the code is working on my home computer but not on the server. On the server I'm getting the following error:
Server: Msg 446, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 76
Cannot resolve collation conflict for equal to operation.
Does anybody know what could cause the error?
Could it be some permissions that I didn't set on my server?
Thanks for my help and suggestions...
Regards,
Gonzal
View 9 Replies
View Related
Oct 18, 2007
Trying to connect to remote server croaktoad.simpli.biz
I have SQL 2005 Developer on XP SP2 , I have disabled my windows firewall. I can ping to my server (croaktoad.simpli.biz) and i get no error message. My remote connection using both TCP/IP and named pipes are checkeed. My SQL Server Browser is running as well.
However when I try to connect using Managment Studio or running SQLCMD /Scroaktoad. simpli.biz /E I get the following error message
C:sqlcmd /Scroaktoad.simpli.biz /E
HResult 0x52E, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [1326].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired
So I've read all the forums for past 2 days and tried everything, nothing changed Any ideas?
View 4 Replies
View Related
Oct 10, 2007
where can i find it?
thanks
View 4 Replies
View Related
Jun 18, 2002
We are using SQL 2k.Can we shrink the space allocated in SQL databases.Please help.
View 1 Replies
View Related
Mar 10, 2004
Hi all,
Sql server 7.0
our client is getting the below error while accessing the web application
Maximum number of DBPROCESSes already allocated
when we check the server from our side its working fine.
please let us know is the solution for this.
TIA
View 2 Replies
View Related
Apr 23, 2007
We are running on SQL 2000 on Windows 2003. We have active-passiveclustering set up. We have 16 GB of RAM on each box. This pastweekend, we failed over. I noticed that the Total Server Memory wentfrom about 15.5 GB to 8 GB. I have been trying to figure out why thishas occurred. Any help would be greatly appreciated.
View 1 Replies
View Related
May 17, 2007
I recently changed the max. memory option in SQL from 24 GB to 30GB but the perfmon counters still only show 24 GB. Any ideas on why it is not recognizing the change? The server has Win 2003 EE and 32 GB of RAM.
View 5 Replies
View Related
Dec 20, 2006
Hello,
I have a bundling package that runs about 20 other packages. It has been working fine for a while but a couple of days ago it fail with the following message,
Error 0x800706BE while loading package file "D:PackagesToradSales.dtsx". The remote procedure call failed.
I´m running the SSIS packages in an 64-bit environment.
Thankful for help with this!
//Patrick
View 3 Replies
View Related
Nov 5, 2007
I'm not sure if this is the correct group for this messages, but here it is anyway.
I have a job that has 3 steps to, periodicly the job errors out on Step 1. Following is the message (from Job History).
--------------------
Executed as user: SMIsqladmin. The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction. [SQLSTATE 42000] (Error 7391) [SQLSTATE 01000] (Error 7312) OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a]. [SQLSTATE 01000] (Error 7300). The step failed.
--------------------
Can someone please explain this message, I have no idea how to fix it or what the cause is.
Thanks
David Davis
View 1 Replies
View Related
Aug 1, 2007
One of our servers has 20GB of memory and SQL server has been allocated 18.5 GB out of it, however SQL Server only uses about 9GB or so.
OS: Windows 2003 Server
MS SQL Server 2000 SP4
awe enabled
min & max server memory (run values) are: 18432
/PAE switch in boot.ini
any help why SQL server is not using 18.5 GB allocated to it, would be greatly appreciated?
View 8 Replies
View Related
Feb 2, 2004
Could anybody tell me how to find out the total space allocated to a database excluding the log files in SQL server 2000. Thanks
View 1 Replies
View Related
Nov 6, 2014
How Indexes are allocates on pages? And If a CREATE INDEX Statement Executed on a query Window, Query processor meets and executes these query. However it was meet, who decides to separate indexes onto pages? Storage Engine or Query Processor(Query Optimizer)? Does it work like UPDATE-Statements in Query Optimizer?
View 4 Replies
View Related
May 2, 2005
We have a database that doesn't seem to be growing on its own correctly (or seems like it isn't). This database has been running really slow for the last week and we think this may be whu
Current size is listed at 963mb while allocated size is 959mb. Trans log size is set to auto-grow and is allocated 4mb
Can we change that number on the fly, and also change the the growth settings without affecting the system?
Being a live system we obviously do not want any downtime, but believe this will help with our slowdown.
Any other ideas would also be appreciated
Thanks!
View 4 Replies
View Related
Dec 11, 2014
how can i check how much space is allocated to the database in SQL Server
View 2 Replies
View Related
Mar 26, 2001
Hi, all,
I found that the SQL2000 EM does not show database space allcoated information, as well as tables and indexes size while SQL 7.0 does.
Someitmes these information are fairly handy.
is there any other easy ways to find out the same info from SQL2000
through Em, or elsewhere ??
Thanks
Anthony
View 1 Replies
View Related
May 15, 2001
My group is trying to ensure that there is a sufficient amount of cushion between the space allocated and the current size of a database. I know that I can check this using the Enterprise Manager. Is there a stored procedure or a systems table that holds this information. I know that sp_spaceused will give me the unallocated space, but i want the allocated space. Any suggestions?
View 2 Replies
View Related
Apr 30, 2015
I am searching for query to find total memory allocated to sqlserver, Â and how much being used utilized as well cpu utilization percentage .Â
View 10 Replies
View Related
Oct 19, 2007
I have a SQL Express database on our server that is used for one of our websites when the website tries to write to the database I get the following error: -
An attempt to attach an auto-named database for file D:lahwebsitesGiants North Walesapp_datadatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
This error is very frustrating and I really can't find a way around it. I have done the following: -
Deleted the SQL Server Express folders under user preferences
View 3 Replies
View Related
Feb 29, 2008
Hi,I am trying to write some C# ASP.NET 2.0 code. I have created a web form to send data to my sql server 2005 database. When I compile the application and insert data then click on the submit button I get this error
"A first chance exception of type
'System.Data.SqlClient.SqlException' occurred in System.Data.dll" I have been trying to solve this for a few days now with no luck, so any help would be appreciated. I'll post below the source code of the web form (addOrder.aspx). It might be worth mentioning that I have created another web form in the same project called addCustomer.aspx. Like addOrder.aspx it is a web form, however it successfully inserts data in the database. 1 <%@ Page Language="C#" MasterPageFile="~/Default.master" Title="Add Order Page" %>
2 <%@ import namespace="System.Data.SqlClient" %>
3 <%@ Import Namespace="System.Data" %>
4 <%@ Import Namespace="System.Web" %>
5 <%@ Import Namespace="System.Configuration"%>
6 <%@ Import Namespace="System.Globalization"%>
7
8 <script runat="server">
9
10 protected void Page_Load(object sender, EventArgs e)
11 {
12
13 }
14
15 protected void sumbitButton_Click(object sender, EventArgs e)
16 {
17 SqlConnection conn;
18 SqlCommand comm;
19 string connectionString =
20 ConfigurationManager.ConnectionStrings[
21 "ShippingSystemConnectionString1"].ConnectionString;
22 conn = new SqlConnection(connectionString);
23 comm = new SqlCommand(
24 "INSERT INTO Order(CustomerID, " +
25 "NumberofItems, DescriptionsofItems, SafeItems) " +
26 "VALUES (@CustomerID, " +
27 "@NumberofItems, @DescriptionsofItems, @SafeItems)", conn);
28 comm.Parameters.Add("@CustomerID", System.Data.SqlDbType.Int);
29 comm.Parameters["@CustomerID"].Value = int.Parse(DropDownList1.SelectedValue);
30 comm.Parameters.Add("@NumberofItems", System.Data.SqlDbType.Int);
31 comm.Parameters["@NumberofItems"].Value = numofitemstxt.Text;
32 comm.Parameters.Add("@DescriptionsofItems", System.Data.SqlDbType.VarChar);
33 comm.Parameters["@DescriptionsofITems"].Value = descofitemstxt.Text;
34 comm.Parameters.Add("@SafeItems", System.Data.SqlDbType.VarChar);
35 comm.Parameters["@SafeItems"].Value = safetxt.Text;
36 try
37 {
38 conn.Open();
39 comm.ExecuteNonQuery();
40 Response.Redirect("Success.aspx");
41 }
42 catch
43 {
44 }
45 finally
46 {
47 conn.Close();
48 }
49 }
50
51
52
53 protected void CustomerIDList_SelectedIndexChanged(object sender, EventArgs e)
54 {
55
56 }
57 </script>
58
59 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
60 <table style="position: static">
61 <tr>
62 <td style="width: 169px">
63 Customer ID:</td>
64 <td style="width: 100px">
65 <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
66 DataTextField="CustomerID" DataValueField="CustomerID" Style="position: static">
67 </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShippingSystemConnectionString1 %>"
68 SelectCommand="SELECT [CustomerID] FROM [Customer]"></asp:SqlDataSource>
69 </td>
70 <td style="width: 178px">
71 </td>
72 </tr>
73 <tr>
74 <td style="width: 169px">
75 Number of Items:</td>
76 <td style="width: 100px">
77 <asp:TextBox ID="numofitemstxt" runat="server" Style="position: static"></asp:TextBox></td>
78 <td style="width: 178px">
79 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="numofitemstxt"
80 ErrorMessage="Number of Items Required" Style="position: static"></asp:RequiredFieldValidator></td>
81 </tr>
82 <tr>
83 <td style="width: 169px">
84 Descriptions of Items:</td>
85 <td style="width: 100px">
86 <asp:TextBox ID="descofitemstxt" runat="server" Style="position: static"></asp:TextBox></td>
87 <td style="width: 178px">
88 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="descofitemstxt"
89 ErrorMessage="Description Required" Style="position: static"></asp:RequiredFieldValidator></td>
90 </tr>
91 <tr>
92 <td style="width: 169px">
93 Are Items safe:</td>
94 <td style="width: 100px">
95 <asp:TextBox ID="safetxt" runat="server" Style="position: static"></asp:TextBox></td>
96 <td style="width: 178px">
97 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="safetxt"
98 ErrorMessage="Are Items Safe?" Style="position: static"></asp:RequiredFieldValidator></td>
99 </tr>
100 <tr>
101 <td style="width: 169px">
102 <asp:ValidationSummary ID="ValidationSummary1" runat="server" Style="position: static" />
103 </td>
104 <td style="width: 100px">
105 <asp:Button ID="sumbitButton" runat="server" OnClick="sumbitButton_Click" Style="position: static"
106 Text="Submit" /></td>
107 <td style="width: 178px">
108 </td>
109 </tr>
110 </table>
111 </asp:Content>
112
113
My order table in SQL server 2005 (express) looks like this:
View 5 Replies
View Related
Jan 27, 2004
Hello-
I have the following sql statement which produced an error when I add the order by clause
SQL = "SELECT DISTINCT nc_department.department, Count(nonconformance.department_id) as 'events', ISNULL(SUM(nonconformance.nc_wafer_qty),0) as wafers FROM nc_department LEFT OUTER JOIN nonconformance ON nc_department.department_id = nonconformance.department_id WHERE nc_department.active = '1' GROUP BY nc_department.department ORDER by nc_department.order_id"
This is the error I get:
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
Any help appreciated
View 10 Replies
View Related
Apr 23, 2004
I'm catching a primary constraint error in SQL and don't want to return the SQL error message back to the client. Is there any way to stop this. Thankyou
View 5 Replies
View Related
May 21, 2004
I need help on this!
When I try to change the data from a table using Web Matrix, then I get this error message.
The table’s data cannot be edited because the table does not contain modifiable columns.
As I need to edit the data’s, how can I solve this?
Thanks for Your Help
Mikel
View 1 Replies
View Related
Sep 8, 2004
I finally installed MSDE and have the icon in my tray at the bottom of the screen.
When I try to connect to a database using the wizard in the web matrix program I get this message:
Unable to connect
SQL Server does not exist of access denied
Connection Open (Connect ())
What might be wrong??
Thanks for your help I'll get it soon (I hope)
Del Dobbs
View 2 Replies
View Related
Dec 17, 2004
HI FRIENDS
WHEN I TRY TO RUN A PROGRAM WHICH BINDS A DATAGRID CONTROL TO A SQL SERVER TABLE I GET A ERROR MESSAGE LIKE [SQL EXECEPTION LOGIN FAILED FOR HOMECOMPUTER/ASPNET] . IF U KNOW WHAT MIGHT COZ THE PROBLEM PLEASE TELL ME.
IAM RUNNING THE MICROSOFT SQL SERVER FORM MY HOME COMPUTER I.E (LOCAL) . IS THERE SOME SETTINGS THAT I NEED TO DO BEFORE RUNNING A PAGE WHICH CONNECTS TO THE SQL SERVER.
View 2 Replies
View Related
Jun 13, 2006
I am trying to set a text field as the primary key for a SQL SERVER Express 2005 Database in Visual Studio. I used the following Command:ALTER TABLE Tablename ADD PRIMARY KEY (fieldname);where you substitute table name and fieldname for the appropriate fields. The error message I am getting is:SQL Execution Error.Executed SQL statement: ALTER TABLE Lake ADD PRIMARY KEY(wbic);Error Source .Net SqlClient Data ProviderError Message: Column 'wbic' in table Lake is of a type that is invalid for use as a primary key column or index.Could not create constraint. See previous errors.How can I fix this so any type of field can be a primary key?
View 7 Replies
View Related