Ghost Primary Key Column

Jun 25, 2006

Hello,
I have a table 'customers', with 2 records:

SELECT * FROM customers;
customerID | customerName
------------------+-------------------------
myFriend | myFriend's Name
test | testing user
(2 rows)

but when I'm asking about customerID column, I get the answer:

SELECT customerID FROM customers;
ERROR: column "customerid" does not exist

What happens? I'm using PostgreSQL 8.1.3

View 4 Replies


ADVERTISEMENT

T-SQL (SS2K8) :: Cannot Define Primary Key Constraint On Nullable Column But Column Not Null

Sep 30, 2014

We have a database where many tables have a field that has to be lengthened. In some cases this is a primary key or part of a primary key. The table in question is:-

/****** Object: Table [dbo].[DTb_HWSQueueMonthEnd] Script Date: 09/25/2014 14:05:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[DTb_HWSQueueMonthEnd](

[Code] ....

The script I am using is

DECLARE@Column varchar(100)--The name of the column to change
DECLARE@size varchar(5)--The new size of the column
DECLARE @TSQL varchar(255)--Contains the code to be executed
DECLARE @Object varchar(50)--Holds the name of the table
DECLARE @dropc varchar(255)-- Drop constraint script

[Code] ....

When I the the script I get the error message Could not create constraint. See previous errors.

Looking at the strings I build

ALTER TABLE [dbo].[DTb_HWSQueueMonthEnd] DROP CONSTRAINT PK_DTb_HWSQueueMonthEnd
ALTER TABLE [dbo].[DTb_HWSQueueMonthEnd] Alter Column [Patient System Number] varchar(10)
ALTER TABLE [dbo].[DTb_HWSQueueMonthEnd] ADD CONSTRAINT PK_DTb_HWSQueueMonthEnd PRIMARY KEY NONCLUSTERED ([Patient System Number] ASC,[Episode Number] ASC,[CensusDate] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

They all seem fine except the last one which returns the error

Msg 8111, Level 16, State 1, Line 1
Cannot define PRIMARY KEY constraint on nullable column in table 'DTb_HWSQueueMonthEnd'.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.

None of the fields I try to create the key on are nullable.

View 2 Replies View Related

Differnce Between A Column That S A Primary Key And A Column That S A Key/index With Isunique=true

Sep 13, 2007



Hi,

Please, What s the differnce between a column that s a primary key and a column that s a "key/index with Isunique=true"?

Thanks a lot.

View 4 Replies View Related

DB Ghost

Jan 9, 2004

Anyone here have experience with DB Ghost? Pros/Cons.

View 3 Replies View Related

Can You Ghost SQL Server?

Sep 25, 2002

I use Ghost and Sysprep to image the OS and core apps, but have never Ghosted the PC with SQL installed.

Is it necessary to restore the image to a drive THEN install SQL (as I currently do), or can I be lazy and Ghost the whole thing?

View 2 Replies View Related

Ghost Cleanup....

Mar 28, 2008

Hi:

I need to restore a DB but it was prevented by a background process of "Ghost Cleanup".
server is SQL2000 ENT. sp4.

It could not be killed, neither it was stoped after restart the server. Is there a way to change its running schedule and/or to kill it when I need to restore the db?

thanks
David

View 1 Replies View Related

Can I Ghost An SQL Server?

Jul 23, 2005

I have a test environment that we rebuild servers on a regular basis.To streamline the process we use ghost. We will be installing SQL onthe servers and want to build a ghost image with that build. We havetested it by doing the build, loading the data, and then stopping allthe services and setting them to manual. After we Ghost the machine,we start up the services and reset them to Automatic. Seems to work.My question is:Are there any risks? Should I expect any adverse affects?Thanks for all your help!

View 2 Replies View Related

You Can't Explain This! ARRRRG! SQL Ghost!

Dec 23, 2007

Hello all,
Where do I start?  My son and I wrote a small ASP.net 2.0 website on XP IIS 5.  Works ok with the standard login controls.
I FTP'ed the files up to a Windows server2003.  I installed the SQL publishing wizard.  I created a .sql file of the data base.
I ran the file in SQL2005 manager to build the data base on SQL express running on the Windows 2003 server.  It installed,  no errors.  great!
The website would not run with Data base connection errors ,  like files or data base was read only,  duplicate database ,  can not run mydatabase.create.  something like that.
I created a new app pool and made sure network service was the account.  Gave network server permissions to the folders,  it started working great.
Now sit down.  I created a few accounts using the website  ok,  no errors, Great!   Then check the database to see if the passwords were encrypted.  The new accounts were not there. 
But the accounts went somewhere????   Must be two databases????  One hidden?
I detached the database I created with the .sql script file....  to see if I would get an error on the browser.  nope still worked. Hmmmm other hidden database still working.... I stopped database server
in the management tool,    It still worked....Ok, I'll get the house check for poltergiests.
I went to SERVICES.  The service was stopped(SQLEXPRESS)..  I changed auto start to manual.  Browsed back to the site again,  finally an error.
I restarted the service,  website worked again,  but the database,  the only user database,  is still detached.  Created more user accounts with no error....
Seached the hard drives for .MDF files.  Found the file I detached and also the ASPNETDB.MDF that I orginally FTP'ed to the server earlier in the APP_DATA folder of the website.  I renamed the  
MDF file to see if then I would get an error,  yep I did.    It then automatcly re-created the MDF file exactly the same size.  Two files in the directory now and now a new error in the browser
about a database mismatch.  Ok  that makes sense.   But it will not allow me to rename the new file so I can rename the original. 
Question is how does SQLEXPRESS run the ASPNETDB.MDF file in the web folder which is not attached to the database engine? 
Why use a SQL pub wizard if ASP.NET creates the database automaticly? Or just "Runs" it?    AM I HIGH?
Thanks in advance,  before I take drugs and sit in a dark closet.
-Wade
 
 
 
 

View 4 Replies View Related

Problem With Ghost Locking...

Sep 28, 2004

Hi

I just now had the strangest error, for some reason a table in my DB was locked by two processes, there is no use with BEGIN TRANSACTION in the queries that execute on the DB and while it suddnely happaned no heavy process was running... I was just browsing the table with the enterprise manager.

After viewing the processes with sp_lock I found the two processes that caused the locking and killed them, this fixed the problem, but I would like to know what caused it...
When viewing the process info with sp_who the status was "sleeping" and in sp_lock in one process the type was "key" and the status was "wait" (mode "s").

Any ideas ?
I'm using SQL-Server y2k + sp3.

Thanks,
Inon.

View 1 Replies View Related

Ghost Records In SQL 2000

Jul 14, 2006

Where did this thread go?

View 1 Replies View Related

Problem With Ghost Cleaner...

Nov 9, 2007

I have problem with 'Ghost cleanup' system process. It is locking up my tables and user transactions are keep getting wait status. So is there any way to disable or change the schedule of ghost cleaner?
Thanks in advance..

View 3 Replies View Related

Problem With Ghost Cleanup

Nov 12, 2007

I have problem with 'Ghost cleanup' system process. It is locking up my tables and user transactions are keep getting wait status. So is there any way to disable or change the schedule of ghost cleaner?
Thanks in advance..

View 12 Replies View Related

Orphan / Ghost Connections

Sep 6, 2007

Hello,

I have a VB program which uses ADODB.Connection to make connection to SQL Server DB.
However, under some circumstances, orphan / ghost connections remain in DB even after the VB program closed.

Here are the facts...

(1) Windows Server 2000 + SQL Server 2000
- run the VB program and made connection to the DB, leave it for 3 minutes, the connection closes when the program closes.
- run the VB program and made connection to the DB, leave it for 3 hours, the connection closes when the program closes.

(2) Windows Server 2003 + SQL Server 2000
- run the VB program and made connection to the DB, leave it for 3 minutes, the connection closes when the program closes.
- run the VB program and made connection to the DB, leave it for 3 hours, the connection does not close even after the program is closed.


Does anyone know if there is any problem with Windows Server 2003 + SQL Server 2000 using ADODB.Connection?
Or is there some kind of "timeout" parameter for which I can set to resolve such issue?

Any help is appreciated!!!

Thanks & Regards,
Andy.

View 11 Replies View Related

Blocking On Something Like Ghost Cleanup?

Aug 23, 2007

I noticed that several connections were blocked by something called Ghost Cleanup (or something like that). I know what the cleanup does, but it often causes blocking for quite a while . . .

Anything I can do about it? SS2000.

Thanks,

Michael

View 1 Replies View Related

Get Primary Key Column

May 29, 2005

Hello, this SQL query gets all columns of a table:

SELECT syscolumns.name AS [Fields in Items Database], syscolumns.type,
syscolumns.length, syscolumns.isnullable FROM sysobjects INNER JOIN
syscolumns ON sysobjects.id = syscolumns.id WHERE sysobjects.name =
'IssueTracker_IssueAttachments' ORDER BY syscolumns.colid

I would like to know, is there a way to get a column saying who is the
primary key in the table ? I am reading columns for tables and
processing them, but I would like to know who is the primary key, is
that possible ?

regards

View 8 Replies View Related

Primary Key Vs Identity Column

Jan 22, 2007

What is the different between Primary key and Identity Column? and when should I them?
(Im just a beginner with databases...)

View 1 Replies View Related

How To Drop Primary Key By Specifying Column Only?

Apr 24, 2007

I checked column from xsd file which created from DataBase.
And before installing my application I will check any column in destination base whether have complete column or not.
 
And if there is any column which is not wanted column(not same as xsd structure)
I will delete it by creating sql command as follow "ALTER TABLE tableName DROP COLUMN column1, column2, ......"
and Execute it by program initialization.
 
So
I need delete it by run-time
 
 
However some column may be Primary Key with any reason
 
That's why I can't delete them by simple command
 
I expect to delete them by specific column instead of specific constraint name which is not sure name.
 
 
Please advise me....

View 2 Replies View Related

SQL Set Primary Key On Existing Column

Nov 28, 2007

Hi everyone,How do I set a primary key on an existing column using SQL statements? I have column persID of type int in table employees. How do I correctly apply the ALTER command to change persID type to INT IDENTITY(1,1) NOT NULL?  Thanks in advance   

View 5 Replies View Related

Primary Key VS Identity Column

Apr 5, 2000

Can anyone explain the Difference between Primary Key and Identity Column in MSSQL Server 6.5. Please give me any example if possible.
Thanks for Help!!!!

View 2 Replies View Related

Can A Column Act As Both Primary Key And Foreign Key?

Sep 11, 2011

Can a column act as both primary key and foreign key, if so what is script.

And can a table have more than one primary keys/foreign keys, if so what is the script.

View 4 Replies View Related

Rename Primary Key Column?

Jul 22, 2014

will there be any issues if i rename a primary key column name,which is already beging referenced as a foreign key by other tables.

View 1 Replies View Related

One Primary Key To Two Column In Same Table

Feb 9, 2015

I have a table name Dispatch with the following column
ID,Date, Name, Pickup, Going

I have a next table called Move with the following column
ID, MoveName

I link Move table with Dispatch table via relationship.
ID_Pickup, ID_Going

upon running query no data is shown unless i remove one of the column form the query either pickup or going ...

View 7 Replies View Related

Select Primary Key Column

Feb 22, 2007

Is there a query that can return teh name of the primary key column of a table ?

View 2 Replies View Related

Column Name In A Primary Key Constraint

Jul 20, 2005

Hi allWould there be a easy way to find the column name(s) which constitutea Primary constraint for a table through navigating the systemcatalogs.I found that the PK Constraint object in syscontraints is showing thecolid = 0.TIANorman

View 2 Replies View Related

Duplication In The Primary Key Column

Sep 21, 2006

Hi
I have a set of excel files that i need to export to sql2005 using ssis. Now the issue is that i have no idea about he data ie it may have duplication in the primary key column. If i export it as it is to sql server, it will cause me problems. Is there any way i can filter out the rows which have duplication in the primary key column?
Umer

View 1 Replies View Related

How To Knw Which Column Is Primary Key In A Table

May 1, 2006

hi all

my question is which query shud i use in sql server 2000 to get which column or columns are primary keys of table

i dont want to use any stored procedures only sql query

sp_primary_keys_rowset is one of d stored proc in sql server 2005 but i couldn't understand which query they are using

i only want to use sql query

View 3 Replies View Related

Determin Name Of Primary Column

Aug 6, 2006

given the name of any table how can i programmatically get the name of the primary key column?

View 1 Replies View Related

Designating An Identity Column When You Already Have Primary Key

Jan 13, 2007

Hello --
Following normal practice, I have an autoincrementing identity column designated as primary key in my table.  I have two other columns that should also contain unique values per record, but the Identity option is greyed out (in Management Studio) for all columns other than the primary key.
 I'm enforcing this programmatically (in my C# code) at this point, but I'd like to back that up with a constraint in the database itself.
Any help is appreciated.
Eric

View 7 Replies View Related

Getting Primary Key Column Names For All Tables

Sep 9, 1999

I have a situation in which i have to get the last value stored in the Primary Key for all the tables. Based on this value i have to update another table which stores the Table names and the last Key value for the table. The values in this table are not correct therefore i have to update it now. I was trying to write a cursor for this but the only problem is i can't get to know how to get the column name on which the primary key is defined for all the tables, thru code.

I would appreciate if someone could help me out with this.

View 4 Replies View Related

Problems With Computing A Primary Key Column

Sep 13, 2006

hi !

Just started playing around with SQL 2000 and I createda sample table called 'actor' which has 4 columns

1. actorID
(formula= LEFT(NEWID(), 3)+ LEFT([actorFirst], 2) +
LEFT([actorLast], 2) + RIGHT(NEWID(), 3))
2. actorFirst
varchar(20) NOT NULL
3. actorLast
varchar(20) NOT NULL
4. actorName
(formula = [actorFirst] + ' ' + [actorLast]

Now my problem is that I want to set a primary key constraint on actorID but it doesn't let me because it the NULL check mark is automatically checked and I cannot check it off ... and I can't set a primary key on something which is allowed to be NULL....

I don't understand why 'actorName' column which is also calculated doesn't have that default NULL checked and locked ....

What am I doing wrong ? Please help ....

View 5 Replies View Related

Creating Primary Key On Nullable Column

Feb 29, 2008

Hello,

I am trying to recreate a primary key that I dropped in a table....

I'm using a statement like

ALTER TABLE temp WITH NOCHECK add CONSTRAINT PK__tempkey PRIMARY KEY CLUSTERED

(

num,
store
)


But apparently the "store" column was created without a "not null" and it let it create the PK during the table creation but now it won't let me add the PK with that nullable column..

Does anyone know how to get it to use that column to create a primary key after the initial table creation?

Here is the error i get

Cannot define PRIMARY KEY constraint on nullable column in table


Thanks a lot

View 5 Replies View Related

Identity Column Primary Key Vs Custom Key

May 22, 2008

We are developing a batabase which is meant for financial domain,so it will import data from different source system..
and data from our data base will be further passed to other applications.

In contex of our system integration with other data sources ,whether is it a good idea to have a auto integer primary key a or to implement some logic to generate primary key?

Can some one guide us to some pratical data base design case studies?or some best practices.?

View 20 Replies View Related

Unsorted Primary Key Column In SQL Server Database

Oct 25, 2007

Update: Changed original post as I figured it was not the problem I stated. 
Hi all,
Heres the problem. I have a table in SQL Server with two fields, PartSubCategory and PartCatID. PartSubCategory is the primary key. When I import an excel sheet with identical columns into this table, the primary key column in the table gets sorted automatically (alphabetically). I don't want this column  sorted but to import the rows from excel in the order as they were. Is this some indexing issue? Is there a fix?
Thanks a lot...Bullpit

View 13 Replies View Related







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