Viewing 15 posts - 31 through 45 (of 192 total)
Something like this would probably do the trick.
SELECT m.id, m.sequence, t.name FROM ( SELECT ID, MIN(sequence) AS Sequence ...
March 28, 2007 at 12:04 am
There have been some good suggestions above and, like others have said, you definitly don't want the distinct in your subquery there. If this is still an issue and...
March 27, 2007 at 12:59 am
As an aside, it's worth nothing that IN/NOT IN (with a subquery), EXISTS/NOT EXISTS, INTERSECT/EXCEPT almost always perform better than an equilivent operation implemented with an INNER or LEFTER OUTER...
March 27, 2007 at 12:54 am
I've always prefered the more concise:
DECLARE @recipients varchar(8000) SELECT @recipients = COALESCE(@recipients + ';','') + COALESCE(email, '') FROM staff SELECT @recipients
Using this code, you don't have a trailing semicolon and you don't...
March 27, 2007 at 12:12 am
You could change your starting if statement to check table existence using something like:
IF EXISTS(SELECT * FROM information_schema.tables WHERE TABLE_NAME IN(''...'')) BEGIN ...
March 26, 2007 at 3:30 pm
How tied are you to these views? I know you need to retain the logic. But are you at a point where these views? You said that you were asked...
March 1, 2007 at 2:03 pm
The most likely cause of your issue is that you are concatenating values that are not VARCHAR(MAX) into a VARCHAR(MAX). You must explicitly convert values that are not stored as...
March 1, 2007 at 1:00 pm
It seems to me that replacing those views with global temp tables would be a really bad idea. You definitely do not want several denormalized copies of your database in...
March 1, 2007 at 12:45 pm
Aaron,
Do be aware that Mohammeds code could potentially overlook procs you wish to drop. You cannot always accuratly look for procs in syscomments by using a where clause such as...
February 21, 2007 at 11:22 am
Actually, what I think you want is:
DECLARE @mybin1 binary(16) SET @mybin1 = 0x098F6BCD4621D373CADE4E832627B4F6 SELECT @mybin1 select sys.fn_varbintohexsubstring(0, @mybin1,1,0)
February 21, 2007 at 9:09 am
Very nice solution Scott, especially the detail of qualifying the object name!
Be aware, though, that INFORMATION_SCHEMA.ROUTINES only stores the first 4000 bytes of the SPROC text. If you are searching...
February 21, 2007 at 8:45 am
As far as suggestions go, You can use
select master.dbo.fn_varbintohexstr(@mybin1)
Be aware that fn_varbintohexstr is and undocumented function, and thus
unsupported and may not be included in future versions of SQL Server.
As far...
February 21, 2007 at 8:24 am
You can definitely make this significantly faster.
Is your read query being blocked by your write query?
How often is your broadcastemails table being updated?
What locks are being acqired?...
February 21, 2007 at 8:05 am
There are a couple of possibilities that I know of.
Yousef Ekhtiari wrote a great article about using
CONEXT_INFO
to acomplish something like that (http://www.sqlservercentral.com/columnists/yEkhtiari/2765.asp).
You can also query
DBCC...
February 21, 2007 at 7:50 am
Viewing 15 posts - 31 through 45 (of 192 total)