Reply to Re: Conditional Column Name On Insert

Your name:

Reply:


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 ....

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация