You are here: Re: Synchronous Bulk-Copy into two table « MsSQL Server « IT news, forums, messages
Re: Synchronous Bulk-Copy into two table

Posted by Erland Sommarskog on 05/27/07 10:43

Khafancoder (khafancoder@gmail.com) writes:
>> There is one final question, I will have to ask: in the real Products
>> table are there any columns beside the IDENTITY column that are unique
>> within a store? If the answer is yes, then my answer is yes, you
>> can do it set-based, and if you tell which version of SQL Server you
>> are using, I can sketch a solution.
>
> no, there isn't.
> but isn't possible through StoreId & ProductId together ?

I don't know what you have in mind here. The key problem is that
when you insert many rows into a table with an IDENTITY column, and you
need to know the generated IDENTITY value for each row and there is
no other columns that identifies the rows, you will need to insert the
rows one by one. Or override the IDENTITY-generation with SET
IDENTITY_INSERT ON. But the latter that the user has privilege for this
operation; it cannot be granted through ownership chain.

> and finally, isn't any other alternative to do insert in UDFs ?
> or executing an sp in a select statement ?

It's not really meaningful of talking about an alternative to something
which is completely dead.

What you really should do is to change the database design, because the
current design is the root to your problem.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация