[dba-SQLServer] SELECT INTO question

David McAfee dmcafee at pacbell.net
Mon Feb 27 17:02:32 CST 2006


Sorry I read that wrong. In SQL 2000, if the correct data types are
selected, it will simply insert the values as new records:


INSERT INTO tblTest SELECT 'Test3'    (table tblTest only has one field, a
char(10) )


If the table does not exist, the table will be created (this is what I was
referring to in my last post).

If the table already exists but the number or columns are different or the
types don't match, then the user will get an error.

David


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of David
McAfee
Sent: Monday, February 27, 2006 2:51 PM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer] SELECT INTO question


SQL Server 2000 works like access. Some coworkers like using this method. I
don't.

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Susan
Harkins
Sent: Monday, February 27, 2006 2:40 PM
To: SQLList
Subject: [dba-SQLServer] SELECT INTO question


In Jet SQL, the SELECT INTO statement will overwrite an existing table if
the target table already exists. I just checked SQL Server Express and it
did NOT overwrite an existing table -- the statement failed with an error. I
uninstalled SQL Server awhile back, so I can't check it -- can anybody tell
me how SQL Server responds?

Susan H.

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com


_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com





More information about the dba-SQLServer mailing list