Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert Row Id's
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01370506
Message ID:
01370512
Vues:
21
>>I have imported an Excel file into a SQL table. There is nothing unique in the data, so I want to add an Id column and populate it with 1 to the record count.
>>
>>How do I do this in SQL 2005?
>
>Create a new table with Identity column and insert from the table with Excel data.

Ok, this worked, but is there an easier way to do this without specifying all the fields?
INSERT INTO AlertImport
		(Active,
		ExpiredDate,
		ContractNo,
		SystemId,
		ItemNumber,
		Description,
		Price,
		ContractSeverityCode,
		EquipmentSerialNumber,
		LineType,
		AddressCode)
	SELECT Active,
		   ExpiredDate,
		   ContractNo,
		   SystemId,
		   ItemNumber,
		   Description,
		   Price,
		   ContractSeverityCode,
		   EquipmentSerialNumber,
		   LineType,
		   AddressCode
	FROM AlertImport
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform