Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert into table values select - but change 1 field
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Application:
Web
Miscellaneous
Thread ID:
01531682
Message ID:
01531684
Views:
33
(2) is what i needed ...
Thanks for your help
Jaime

>>Hi all
>>In a sql table, i would like to insert a subset but changing the value in just 1 field.
>>I have a table with fields field1, field2, field3. I would like to select all rows with value 5 in field1, and insert the result rowset but changing the value of field1 to 6 prior to inserting. Is it doable in one insert command?
>>
>>Thanks
>>Jaime
>
>Jaime,
>
>This is vfp syntax - but I take it sqlserver as well - remove the semi colons
>
>
>	create cursor pp ;
>	(	field1	I, ;
>		field2	I, ;
>		Field3	I ;
>	)
>	insert into pp values (1, 2, 3)
>	insert into pp values (4, 5, 6)
>	insert into pp values (5, 6, 6)
>	insert into pp values (5, 7, 7)
>	
>	&& (1)
>	insert into pp (field1, field2, field3 ) ;
>		select field1+1, field2, field3 ;
>			from pp ;
>			where	(field1 = 5)
>	
>	&& (2) 
>	insert into pp (field1, field2, field3 ) ;
>		select 6, field2, field3 ;
>			from pp ;
>			where	(field1 = 5)
Why do programs stop working correctly as soon as you leave the Fox?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform