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 |
|
learntsql
524 Posts |
Posted - 2010-03-29 : 09:29:21
|
| Hi All,How to capture where condition trace as part of select statement it self.for eg;select * from empwhere ISExpired IS NOT NULL...Now i want to insert one trace record into Audit table as ISExpired is nullCan we capture as part of select statement or any other way.Sorry if i am not clear.TIA. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-29 : 11:42:58
|
| Sorry you're not clear. which audit table you are talking about? explain with an example------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
learntsql
524 Posts |
Posted - 2010-03-30 : 00:59:38
|
| let me explain.i have table called Employee (Eno,Ename,Designation,Deptno,ISExpired,Age).i am performing select operation on this table as likeCREATE PROC proc_ReadEmpData( @EmpNo int, @Age int, @Desig varchar(50))ASBEGINselect *from Employee WHERE ISExpired IS NOT NULLANd EmpNo = @EmpNoAND Age=@AgeAND Designation = @DesigEND--EXEC proc_ReadEmpData 101,25,'Admin'When i execute this procedure i pass the above values as parameters.for this employee ISExpired value is nullThat I want to capture and store/insert into on of the tracing(user defined) tables under remarks column as ISExpired is null(for eg;)similer to this i use few more filters in WHERE clause and all i want to capture into tracing table.TIA. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-30 : 13:16:27
|
| for capturing this info dump the above select's resultset to your table using INSERT...SELECT------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|