|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SELECT INTO PROBLEMI have two tables.. They are both identical..
I want to select some fields from one and insert to another one. How can i do it ? SELECT urunadi INTO [AlisverissaatiXML].[dbo].[urunler] FROM [Kangurum].[dbo].[urunler] WHERE urunadi='ROMANSON PHIL MEETY' It returns The object name 'AlisverissaatiXML.dbo.urunler.' contains more than the maximum number of prefixes. The maximum is 2. Savas Ates wrote:
> I have two tables.. They are both identical.. INSERT INTO [AlisverissaatiXML].[dbo].[urunler] (col1, col2, col3, ...)> > I want to select some fields from one and insert to another one. > How can i do it ? > > SELECT urunadi INTO [AlisverissaatiXML].[dbo].[urunler] FROM > [Kangurum].[dbo].[urunler] WHERE urunadi='ROMANSON PHIL MEETY' > > It returns > > The object name 'AlisverissaatiXML.dbo.urunler.' contains more than the > maximum number of prefixes. The maximum is 2. SELECT col1, col2, col3, ... /* ... list the columns you require */ FROM [Kangurum].[dbo].[urunler] WHERE urunadi='ROMANSON PHIL MEETY' ; -- David Portas SQL Server MVP -- Hi Savas,
Select into is used if you want to create a new table based on the provided schema of the selected columns in your statement. If you want to insert data into an exsiting table you should rather use INSERT INTO: INSERT INTO [AlisverissaatiXML].[dbo].[urunler] ( urunadi ) SELECT urunadi FROM [Kangurum].[dbo].[urunler] WHERE urunadi='ROMANSON PHIL MEETY' HTH, Jens Suessmeyer. > INSERT INTO [AlisverissaatiXML].[dbo].[urunler] Or in this trivial case:> ( > urunadi > ) > SELECT urunadi > FROM [Kangurum].[dbo].[urunler] > WHERE urunadi='ROMANSON PHIL MEETY' INSERT [AlisverissaatiXML].[dbo].[urunler] ( urunadi ) SELECT 'ROMANSON PHIL MEETY' Show quote :-) |
|||||||||||||||||||||||