Viewing 15 posts - 541 through 555 (of 1,217 total)
I think you should not include sysdatabases. Why would you do it?
Sysobjects and sysindexes are in each database; that means, your query always works only with tables from the CURRENT database....
November 2, 2006 at 5:20 am
That's it, Sergiy... I said right at the beginning that I would know how to do it with CASE, but then started to ponder about your solution that wasn't using...
November 2, 2006 at 4:42 am
Hi Murtaza,
this is how you could do it:
/*parameters*/
DECLARE @datefrom DATETIME, @dateto DATETIME
SET @datefrom=GETDATE()+14
SET @dateto = GETDATE()+28
/*query*/
SELECT Q.memberID,Q.Title,Q.FirstName,Q.LastName,Q.DOB,Q.Email,Q.Country
FROM
(SELECT memberID,Title,FirstName,LastName,DOB,Email,Country,
DATEADD(yy,DATEDIFF(yy,BirthDate,0),BirthDate) as DMOB /*day and month of birth*/
FROM dbo.members) as Q
WHERE DMOB...
November 2, 2006 at 1:19 am
No, ; and GO will not work in dynamic SQL - at least not in SQL Server 2000. The only way is to change database before you start dynamic SQL,...
November 2, 2006 at 12:45 am
DATEADD and DATEDIFF functions have very good performance, as long as you stick to this way, you should be OK. Performance problems can be sometimes caused by excessive use of...
November 1, 2006 at 8:12 am
Oh... right, I forgot about that. Well, then no, I don't know how to create procedure in another DB using dynamic SQL - but I wouldn't want to do it anyway. Are...
November 1, 2006 at 5:36 am
Did you try to include USE command into the dynamic SQL? That should be enough.
select @sql = 'USE db_name create proc newsp as select 1'
November 1, 2006 at 5:26 am
I'm still guessing, but it seems to me that such GROUP BY clause will not work... as I understand it, the only thing that has to be the same in these...
November 1, 2006 at 2:54 am
Or you can use this (I like it more than IN clause and at least sometimes it works a lot quicker - didn't do any extensive testing though):
SELECT M.ItemCode
FROM tblMaster M
LEFT JOIN...
October 31, 2006 at 8:32 am
Hmm.. I think it more probable that there was a typo in the first post and no cross join is required. Following query could be how it is now:
SELECT loi.LOB_ID,...
October 31, 2006 at 8:24 am
Actually, this isn't next birthday. It is the birthday for current year, no matter whether it is in future or past.
I'm not sure whether it is possible to get next...
October 31, 2006 at 7:59 am
This looks pretty dangerous... "needs to be applied to many, many tables". In my opinion it should be used sparingly, more as a workaround than as a standard. Are you...
October 30, 2006 at 8:11 am
1. Do whatever you can to change "localday" column to DATETIME. If INT is required by some application or you can't change it for some other reason, consider creating another column that...
October 30, 2006 at 2:48 am
Yeah, that could be it... Bhushan, is the computer on which this SP runs configured as mail server? I guess you are launching that on your SQL Server... which probably isn't mailserver...
October 27, 2006 at 7:55 am
Jason,
just in case you don't know - if you click on "Watch This Topic" link at the top of page, you will receive notifications of new posts even if you...
October 27, 2006 at 1:36 am
Viewing 15 posts - 541 through 555 (of 1,217 total)