Apr
14
awarded Nice Question
Apr
7
awarded Notable Question
Mar
24
awarded Popular Question
Mar
16
accepted Iterating to a distinct list and insert values into another table
Mar
16
comment Iterating to a distinct list and insert values into another table
@RhysJones I'd prefer to insert via the SP to keep a consistent workflow / script. In the rest of the script, all status messages that need to go to the audit log, are inserted via the SP. Does that make sense?
Mar
16
accepted Deleting a stored procedure in the database
Mar
16
asked Deleting a stored procedure in the database
Mar
16
asked Iterating to a distinct list and insert values into another table
Mar
16
accepted How to send query result to stored procedure correctly?
Mar
16
asked How to send query result to stored procedure correctly?
Mar
13
comment How to compare a count() to a value from another table?
no, it is a variable from a variables-table. In reality it is something like number_of_lines_of_file_xxx
Mar
13
comment How to compare a count() to a value from another table?
table_a is a variables-table so each key is unique. Another question: I usually update table_c via a stored procedure (e.g. exec dbo.audit_log 'Compare values from 2 tables', 'Values Match';). I tried the following but it didn't work. How can I make this work? exec dbo.audit_log 'Compare values from 2 tables', ( select case when (select count(1) from table_a) != (select row_count from table_b) then 'Values do not match' else 'Values match' end )
Mar
13
accepted Is there any way to let users declare variables on top of SQL script?
Mar
13
asked How to compare a count() to a value from another table?
Mar
13
awarded Yearling
Mar
13
awarded Yearling
Mar
13
comment Stored procedure for often-used query?
I'm using if object_id('make_audit_log', 'U') is not null drop procedure make audit_log go and I get returned Command(s) completed successfully. However, if I then run the create procedure statement, I get returned There is already an object named 'make_audit_log' in the database. Why was it not deleted, even though I get no error returned? create procedure dbo.audit_log ( @query varchar(100) , @result varchar(100) ) as insert into [CA131RB01_QC] (finished, query, result) values (getdate(), @query, @result) go
Mar
13
accepted Stored procedure for often-used query?
Mar
13
comment Is there any way to let users declare variables on top of SQL script?
Please see the [--edit--]...the user now has to fiddle in the 2 insert-statements to get the correct values into the database. What if he makes a mistake (e.g. removing a quote). I'd rather not have users fiddling with the queries themselves.
Mar
13
revised Is there any way to let users declare variables on top of SQL script?
added 292 characters in body
1 2 3 4 5