Viewing 15 posts - 5,116 through 5,130 (of 5,393 total)
hi_abhay78 (6/23/2009)
select name,modify_date from sys.objects where type ='P'
Ok, this works but does not return the number of times the procedure is modified. Anyway is a nice way to return last...
-- Gianluca Sartori
June 23, 2009 at 1:18 am
You can use database triggers to accomplish this task.
I use this simple one:
1) Code for destination table:
CREATE TABLE [dbo].[ChangeLog](
[LogId] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
[DatabaseName] [varchar](256) NOT NULL,
[EventType] [varchar](50) NOT...
-- Gianluca Sartori
June 23, 2009 at 12:58 am
This could sound like a silly reply, but, what about optimizing the query so that it runs faster on the linked server?
Are you running the query with OPENQUERY / EXECUTE...
-- Gianluca Sartori
June 23, 2009 at 12:53 am
June 12, 2009 at 3:21 am
Try using a temp table instead. Table variables exist only in the scope they're defined in.
Take a look at this article[/url]: it's an excellent resource for a complete understanding of...
-- Gianluca Sartori
June 12, 2009 at 3:17 am
I look forward hearing from you.
Good luck!
-- Gianluca Sartori
June 12, 2009 at 3:10 am
You might also be interested in taking a look at this article on dynamic search conditions.
I think it is one of the best resources on the topic.
Regards
Gianluca
-- Gianluca Sartori
June 12, 2009 at 3:06 am
Try with this:
SELECT *
FROM table
WHERE Id = COALESCE(@id,Id,-1)
I chose -1 as a non existent value for Id to exclude NULL values for Id column, but this depends on the data...
-- Gianluca Sartori
June 12, 2009 at 3:03 am
Well done, Gail!
I think this is going to be part of many people's signature like Jeff's article on posting best practices.
-- Gianluca Sartori
June 12, 2009 at 2:29 am
RBarryYoung (6/12/2009)
Does anyone know of any client-code DB tools that change their queries into sp_executesql calls? Does Linq-to-SQL or Linq-to-Entities do that?
Some Java jdbc drivers turn prepared statements into...
-- Gianluca Sartori
June 12, 2009 at 1:00 am
GilaMonster (6/11/2009)
... the keyword 'column' doesn't need to be there.
That's right Gail, I'll edit my previous post.
Mjarsaniya, you can use the dynamic sql when the columnname is determined at...
-- Gianluca Sartori
June 11, 2009 at 8:55 am
The problem is with the variable, you can't use it that way. You should define the whole alter statement in a string variable and the execute it:
DECLARE @sql nvarchar(4000)
SET @sql...
-- Gianluca Sartori
June 11, 2009 at 8:48 am
You could do it splitting the parameters into a table with a script like this:
http://www.sqlservercentral.com/scripts/T-SQL+Aids/31871/
There are lots around, even more efficient, with tally tables or with loops, just pick one.
create...
-- Gianluca Sartori
June 11, 2009 at 8:37 am
No, you can't with table variables. You can do it with temp tables.
Take the time to read this[/url] article on the topic. I found it excellent.
Regards
Gianluca
-- Gianluca Sartori
June 11, 2009 at 8:29 am
Viewing 15 posts - 5,116 through 5,130 (of 5,393 total)