Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-05-01 : 08:53:11
|
| Diego writes "Hi everyone!I have this problem... in a Temp table i have (car, model, year, cost) and need to put this data in tble_car(id_car, car, nextmodelid), tble_model(id_car, id_model, model), tble_cost(id_car, id_model, year, cost)i think something like that:CREATE PROCEDURE SP_segAuto_refreshFromTEMP/* Refresca los datos de las tablas de marca, modelo y cotizacion de automobiles tomando los nuevos datos de la tabla temporal 1) borra los datos actuales de las tres tablas 2) pone a cero la numeradora 3) inserta en cascada en las tres tablas*/ AS Declare @aux_idmarca int, @aux_idmodelo int SELECT (if NOT exists(SELECT m.marca FROM tble_segAutomarca m WHERE m.marca = t.marca) EXEC @aux_idmarca = SP_segAutonewMarca marca), (if NOT exists(SELECT mo.modelo FROM tble_segAutomodelo mo WHERE mo.id_marca = @aux_idmarca AND mo.modelo = t.modelo) EXEC @aux_idmodelo = SP_segAutonewModelo @aux_idmarca, tble_segAutoTEMPcoti.modelo ), (EXEC SP_segAutonewCoti @aux_idmarca, @aux_idmodelo, t.anio, t.cotizacion FROM tble_segAutoTEMPcoti tbut i'm not shure is fine...sorry by my bad english guys.... and tnx" |
|
|
|
|
|
|
|