|
hi.
U will again have to use a trigger. but not the autoincrement features.
maintain a count of the company ids.
u can use string concatenation to insert "RXY" + the company id count, while inserting the string in the company id column.
Keshav Kamat
India
|
|
|
|
|
Thx Tirtha,
yes u r right..
when inserting a record in table there is no checking mechanism to prevent duplicacy and it is difficult to check each and every record while inserting as
data is uploaded in bulk.
It is not that i have duplicate customerids in the table but there
are same records (e.g. same customer info.) on different customerids.
where customerid is the primary key.(Auto number)
Thanx and Regards,
Ahmad
|
|
|
|
|
You could make a DISTINCT select on a certain field (f.e. email address, or name + lastname) and select it into another table. Then you can just swap the tables.
But I recently did this with our mailing list, and this was the easiest solution.
SELECT *<br />
INTO Table2<br />
FROM Table1 AS T1<br />
WHERE T1.email NOT IN (SELECT DISTINCT email FROM Table2 AS T2 WHERE T2.ID < T1.ID)
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hi Ahmad,
Try using the DISTINCT keyword.
It might help.
Keshav Kamat
India
|
|
|
|
|
thx keshav ..but trying distinct keyword on 21 columns is a difficult job
Ahmad
|
|
|
|
|
I want to Install my SQL 2005 on D:/ but On running setup it takes it to default C:/, even I changed path in .setup file but problem persist.
I want this because I don't have enough space on C:/
Develop2Program & Program2Develop
|
|
|
|
|
No matter what disk you will select during setup, SQL Server 2005 will put some (quite a lot, in fact) files on the C: drive.
As far as I know, this cannot be avoided. And it really sucks.
BTW, why do you mean by in .setup file? Are you using some kind of unattended setup?
|
|
|
|
|
no dear there is setup file containing the information regarding the setup in which filepath is also defined . i just tried to overwrite it, such tweaks does work but I failed in this case.
Develop2Program & Program2Develop
|
|
|
|
|
hi,
i have created a table named CompanyDetails.in this table Company name is one column,and CompanyID is another column,i want when i will enter the company name company id will autogenerated like RXY12365,how i will do it?
if i will make companyID as identy column it will generate only int values like 1,2.
p.sethi
|
|
|
|
|
Please explain this further - RXY12365.
Do you need an ID that consists of 3 capital letters and then 5 integers?
Should it be random?
Why do you need something like this?
|
|
|
|
|
Using trigger in stored procedure. When insert occurred, edit the companyID.
|
|
|
|
|
Hi
Use a trigger, so that the values in the company id are autoincremented/updated/kept same, according to the changes made in the company name.
Keshav Kamat
India
|
|
|
|
|
can any one give me a link to tutorials bout ADO.Net or explain to me with examples of codes
vuyiswamb@yahoo.com
Vuyiswa Maseko
South Africa
|
|
|
|
|
|
http://www.devcity.net/Articles/14/start_ado_net.aspx
A quick and easy VB.NET example. Are you looking for vb.net or c#?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
|
I have table customermaster which has a around 200000 records.
Problem is this that there are same customers on different customerids
for ex.
customerid 1 : ABC
customerid 2 : ABC
that there are duplicate records.....
I have tried several things but i am not getting any result.....
Can any one help to get rid of this duplicacy.
Ahmad
|
|
|
|
|
I am not very clear about your problem.....when inserting record in table you have no checking mechanism to prevent duplicacy.....if you dont want to insert duplicate record check for duplicacy first and then insert.....
moreover if it is not possible then create a AutoNumber field in your table.....which will not be duplicated while inserting records....you can have ,in this way,a unique ID to identify customers....
if the case is different please clearly point your problem....
Tirtha
"A man can ride on your back only when it is bent....."
|
|
|
|
|
Hi dear ,
you can override this problem by making CustomerID and CustomerName as primary key. This will check for both the Column before inserting
Develop2Program & Program2Develop
|
|
|
|
|
Or making CustomerID only as primary key.
|
|
|
|
|
dear,
If we give primary key only to Id then Same answer becomes the question.
this guy also want that his name also not be duplicated, and hence to avoid this occurance we consider Id and Name both as PK.
I may be mistaken to get your view you posted above.
Develop2Program & Program2Develop
|
|
|
|
|
Correct me if I'm wrong. If CustomerID and CustomerName as primary key, it wouldn't change anything.
CustomerID CustomerName
1 ABC
2 ABC
I think it will still go into the database.
|
|
|
|
|
dear ,
Yes I am wrong in that prespective , I really left the Autogenerated Id , yes you are right.
Develop2Program & Program2Develop
|
|
|
|
|
I don't get it. What's the problem of having two record with the same customer name? What are you trying to do? Many people often have the same name.
|
|
|
|
|
These ar not persons name //customers here are organizations....
so i have same organizations(e.g. Microsoft Corp.) with same contact details
on two different customerids
Thx and rgds
Ahmad
|
|
|
|