Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating test data
Message
 
To
01/11/2006 15:37:45
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01166318
Message ID:
01166356
Views:
13
This depends of you :-) Are you too lazy to write all 40 in that query?
BTW there is a easy way to put ALL fields in query:
write:
SELECT 
then drag Columns node from Object explorer and drop it right after SELECT. That will build you SELECT (field list here)
Then you must find and delete field in question. Only anoynig thing is when you build a Table variable, becuase you need to set field types.


>Thanks Borislav,
>
>The table has 40 odd fields. Is that too many?
>
>>How many fields you have in that table? If you have a relatively small number of fields you could use something like that:
>>
>>DECLARE @Test TABLE ( stucture as your original table except the field you want to be unique, UniqueField Ine IDENTITY(1,1))
>>DECLARE @i int
>>SET @i = 0
>>WHILE @i < 10 && or whatever number you need to get 1.5 mil. records
>>      BEGIN
>>          INSERT INTO @Test (field list here EXCEPT UniqueField)
>>          SELECT (field list here EXCEPT UniqueField)
>>                FROM MyTable
>>          SET @i = @i + 1
>>      END
>>INSET INTO MyTable
>>SELECT (field list here EXCEPT UniqueField), CAST(UniqueField as varchar(50)) FROM @Test
>>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform