|
Posted by MGFoster on 01/21/06 02:19
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Try something like this instead:
If @eotID = 1
BEGIN
INSERT INTO OT (OTFechaBorrador)
VALUES ...
END
IF @eotId = 2
BEGIN
INSERT INTO OT (OTFechaAAsignar)
VALUES ...
END
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQ9F9/oechKqOuFEgEQL0DwCfVQyA7xrkbFiBhXHJwcZwh6jlv1sAnj8x
Ig0V5L9rm9Cpt13pG+Talbie
=0ECz
-----END PGP SIGNATURE-----
cavassinif@gmail.com wrote:
> I need to dynamic select a column in which insert a vale based on a
> parameter value, I have this code, but it throws an incorrect syntax
> error.
>
> How do I dinamically select a column to insert based on a parameter?
>
> Create PROCEDURE dbo.UpdateDetalleOT (
> @eotId int,
> )
>
> insert into OT (
> select Case
> when @eotId = 1 THEN OTFechaBorrador
> when @eotId = 2 THEN OTFechaAAsignar
> end
> ) values ....
Navigation:
[Reply to this message]
|