March 2, 2017 at 8:35 am
Hi guys, I am trying to create a new table from an existing table and I am using the code below but I cannot get it to work
Any ideas?
thanks in advance
USE [WorkLSC]
GO
CREATE TABLE [DBO.T_NEWTABLE]
AS (SELECT *
FROM [WorkLSC].[dbo].[vw_OLDTABLE)
GO
March 2, 2017 at 8:40 am
Try this
SELECT * INTO [DBO].[T_NEWTABLE]
FROM [WorkLSC].[dbo].[vw_OLDTABLE)
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 2, 2017 at 8:40 am
Hi I used
select*
into new_table
from old_table
But received this warning :
Warning: Null value is eliminated by an aggregate or other SET operation.
Is there anything I should worry about?
thanks again
March 2, 2017 at 8:41 am
Try:USE [WorkLSC];
GO
SELECT *
INTO [DBO.T_NEWTABLE]
FROM [WorkLSC].[dbo].[vw_OLDTABLE];
GO
Note, however, it is terrible practice naming a table with the prefix "DBO.". I would suggest naming it something else.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
March 2, 2017 at 8:41 am
ExhibitA - Thursday, March 2, 2017 8:35 AMHi guys, I am trying to create a new table from an existing table and I am using the code below but I cannot get it to workAny ideas?
thanks in advance
USE [WorkLSC]
GOCREATE TABLE [DBO.T_NEWTABLE]
AS (SELECT *
FROM [WorkLSC].[dbo].[vw_OLDTABLE)GO
You can use select into
😎
SELECT
*
INTO dbo.NEWTABLE
FROM [WorkLSC].[dbo].[vw_OLDTABLE;
March 2, 2017 at 8:45 am
ExhibitA - Thursday, March 2, 2017 8:40 AMHi I usedselect*
into new_table
from old_tableBut received this warning :
Warning: Null value is eliminated by an aggregate or other SET operation.
Is there anything I should worry about?
thanks again
I'm going to guess that what you're selecting from is not a table, but a view (based on the prefix "vw_", and the error wouldn't occur on a simple SELECT * on a table). This message is letting you know that the values NULL in your aggregate function, which is in your view definition, are being ignored (not used in the aggregate calculation),.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply