From: Andrea Caldarone on 25 Nov 2009 10:12 "Scott Morris" <bogus(a)bogus.com> ha scritto nel messaggio news:ObuL8$dbKHA.1596(a)TK2MSFTNGP06.phx.gbl... > Use a view. There isn't any mechanism within sql server to intercept a > select statement or its resultset and alter either. If your reason for > asking involves an application that you cannot control, you might be able > to work around that by changing the name of the existing table and > creating a view to act as its substitute. Another approach is to use a > stored procedure. Still yet another approach is to simply change the query > to generate the resultset you desire - if that is possible. > A view instead of a table... works for the select issued by the application (that as you guessed I cannot control) but when that application try to insert and/or update? It searches for a certain name that is a view and doesn't support inser/update stetement...
From: Scott Morris on 25 Nov 2009 10:31 > A view instead of a table... works for the select issued by the > application (that as you guessed I cannot control) but when that > application try to insert and/or update? It searches for a certain name > that is a view and doesn't support inser/update stetement... You might want to review the information in BOL about updateable views and instead-of triggers. You might be pleasantly surprized that this **might** work. Your options are very limited if you have no control over the application. If you are using a licensed application, you might also want to consider that altering the schema may affect future support and upgrades.
From: TheSQLGuru on 26 Nov 2009 11:10 I believe that there are third-party network-sniffing products that intercept TDS packets and can do select statement captures. High-end stuff tho... -- Kevin G. Boles Indicium Resources, Inc. SQL Server MVP kgboles a earthlink dt net "Andrea Caldarone" <andrea.caldarone(a)poste.it> wrote in message news:%23Bhl7ebbKHA.1648(a)TK2MSFTNGP05.phx.gbl... > Hi all, > > I know that "trigger on select" does not exists, I'm searching something > to > accomplish this need: > > I have a table, let's say: > [Some_table] > [ID] int primary key > [Flag] bit > [Some_Field] nvarchar(40) > > when a user (all user) does a select on a row of that table that has > [Flag]=1 the select statement does not returns the correct value for > [Some_Field] column but a specific value that I specify in the "trigger on > selest". > > How can I do this? >
From: Andrea Caldarone on 27 Nov 2009 06:48
"TheSQLGuru" <kgboles(a)earthlink.net> ha scritto nel messaggio news:pbadnUBq865MOpPWnZ2dnUVZ_gednZ2d(a)earthlink.com... >I believe that there are third-party network-sniffing products that >intercept TDS packets and can do select statement captures. High-end stuff >tho... > > -- > Kevin G. Boles > Indicium Resources, Inc. > SQL Server MVP > kgboles a earthlink dt net > > Yes I know, but I don't want to capture packet, but to modify them... |