<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">Ya te expliqué. Debes usar el sqlscript, sirve para eso.<br>Pero primero debes reveer el acceso y bloqueo que quieres lograr. Ya los motores lo tienen resuelto de muchas maneras </div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">De: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:socger@gmail.com">SocGer</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Enviado el: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">‎23/‎12/‎2015 19:31</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Para: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:lazarus-es@lists.lazarus.freepascal.org">lazarus-es@lists.lazarus.freepascal.org</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Asunto: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">Re: [Lazarus-es]¿Como conseguir hacer varias SQL juntas?</span><br><br></div><div dir="ltr"><div><span style="font-size: 12.8px;">El día 22 de diciembre de 2015, 6:03, SocGer &lt;</span><a style="font-size: 12.8px;" href="mailto:socger@gmail.com">socger@gmail.com</a><span style="font-size: 12.8px;">&gt; escribió:</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; Buenas, uso los componentes TSQLQUery para hacer consultas, Insert o update.</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; Pero no consigo por ejemplo hacer varias cosas al mismo tiempo con estos</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; componentes. Por ejemplo un insert, después un update y despues una select.</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt;</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; En Delphi 5 conseguía hacerlo sin problemas mediante ODBC, pero deseo</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; hacerlo con los componentes TSQLQUery por la facilidad de cambiar de base de</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; datos sin modificar los componentes.</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt;</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; Además también necesito crear funciones o procedimientos en la base de datos</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; en tiempo real desde estos componentes y no consigo tampoco hacerlo.</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt;</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; Tiene que ser posible seguro, pero igual no lo estoy haciendo bien. ¿Puede</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; alguien enviarme ejemplos o un link, que me aclare como conseguir hacer las</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; dos cosas que no consigo?. La de hacer varias consultas dentro de una misma</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; estructura SQL (Insert, update y select) y la de conseguir crear sobre la</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; base de datos un procedimiento o una función.</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt;</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; Muchas gracias por vuestra labor de formación y gracias de antemano por</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt; vuestra ayuda.</span><br></div><div><span style="font-size: 12.8px;"><br></span></div><div><br></div><div>*****************************************************************************************</div><div>*****************************************************************************************</div><div><br></div>Gracias a todos, pero creo que me expliqué a medias.<div><br></div><div>Lo que nos comenta Maxi, es cierto</div><div><br></div><div><span style="font-size: 12.8px;">&gt;&nbsp;</span><span style="font-size: 12.8px;">Para crear algo en la base lo haces con un query pero en vez de hacer</span><br style="font-size: 12.8px;"><span style="font-size: 12.8px;">&gt;&nbsp;</span><span style="font-size: 12.8px;">open, usas excecsql.</span><br></div><div><span style="font-size: 12.8px;"><br></span></div><div><span style="font-size: 12.8px;">Y así lo hago.</span></div><div><span style="font-size: 12.8px;"><br></span></div><div><span style="font-size: 12.8px;">Pero imaginar que tengo que hacer un Insert en una tabla y luego después un Update. Ok?</span></div><div><span style="font-size: 12.8px;"><br></span></div><div><span style="font-size: 12.8px;">Pues si los dos los intento hacer dentro de un solo query y usando execSQL, me genera un error.</span></div><div><span style="font-size: 12.8px;">Sin embargo si los hago por separado ... dos query, funciona perféctamente.</span></div><div><span style="font-size: 12.8px;"><br></span></div><div><span style="font-size: 12.8px;">Pero no me interesa hacer dos query, porque otro usuario puede entrar al mismo tiempo (entre el Insert y el Update) y modificarme algo que no debe mientras estoy haciendo estos pasos. Es decir que tengo que entrar yo primero en el motor de base de datos hacer el Insert y el Update, y luego otro usuario si quiere después de mi.</span></div><div><span style="font-size: 12.8px;"><br></span></div><div><span style="font-size: 12.8px;">Por eso de hacerlo todo sobre una SQL y en un solo query.</span></div><div><br></div><div>Si alguien lo consiguió, me puede decir como. Por supuesto sin usar funciones sobre la Base de Datos ni procedimientos almacenados.</div><div><br></div><div>Saludos y gracias de antemano.</div><div><br></div></div>
</body></html>