Viewing 15 posts - 631 through 645 (of 698 total)
what you can also do, if what you actually care about is the number of records that *were* updated, rather than the number of records that *will* be updated, is...
August 19, 2009 at 9:37 am
i don't understand what you mean. you're going to have to provide some sample data in a more clear fashion for me adapt the query for you.
on that note -...
August 19, 2009 at 9:31 am
for all these dynamic SQL things, you might want to consider reading this article:
http://www.databasejournal.com/features/mssql/article.php/3830981/T-SQL-Best-Practices--Part-2.htm
for example, the code drew posted,
ALTER procedure Emp_name_proc
(
@emp_id varchar(100)
)
as
begin
declare @sql varchar(100)
select @sql =...
August 19, 2009 at 6:28 am
drew.allen (8/18/2009)
Create Table ##temp
The global temp table can be...
August 19, 2009 at 6:03 am
if i understood his requirement correctly, what he wants to do is find all the members who didn't have a membership the month before their current one.
August 18, 2009 at 12:41 pm
table structure and sample data would really help, but you could probably do something like this:
DECLARE @startDate SMALLDATETIME
DECLARE @endDate SMALLDATETIME
SET @startDate = '2009-01-01'
SET @endDate = '2009-12-01'
SELECT
m1.MEMBID,
(
CASE
WHEN m2.MEMBID IS...
August 18, 2009 at 12:29 pm
you're really going to have to provide more info if this query doesn't work, since we don't have anything to help you with.
insert into aaa
select e.lastname as bbb, o.orderdate as...
August 18, 2009 at 12:20 pm
you should also *really* avoid doing this:
"select (e.lastname as bbb, o.orderdate as cccc)
from employees e, orders o where e.employeeid=o.order id "
that sort of syntax is most likely going to be...
August 18, 2009 at 11:39 am
the scope of your temp table probably isn't sufficient.
you haven't really presented much information, but i'd assume what you're doing is something like this:
CREATE TABLE #Temp
(
stuff
)
INSERT INTO #Temp(stuff)
SELECT values
exec...
August 18, 2009 at 11:34 am
AND (VV.Fund_Valuation_Date = (SELECT MAX (Fund_Valuation_Date)
FROM dbo.Fund_Valuation VVV
WHERE VVV.Fund_Valuation_Date < '2006-09-01'
AND VVV.Fund_Number = V.Fund_Number
AND VVV.Class_Type_Abbr_Name = V.Class_Type_Abbr_Name
AND VVV.Class_Type_Category = V.Class_Type_Category))
that fund_valuation_date is being refered to by V, VV, and VVV....
August 18, 2009 at 9:46 am
Did you try changing the subquery to use the alias, and see if it still crashes?
August 18, 2009 at 9:06 am
Hm.
A few things about that -
first, it says its not usable within a stored proc. this is unfortunate, since i'd really like to be able to have the stored...
August 18, 2009 at 7:46 am
since your subquery is going to return a different value for each row of the outer query, it would be impossible to extract a single variable and then invoke the...
August 18, 2009 at 7:41 am
for these purposes it's sufficient for me to just know that the statement is syntactically valid, IE it will execute. whether it produces the result that the user intended is...
August 18, 2009 at 7:29 am
i'd very much recommend that for future queries, you adopt the SQL 2k5+ syntax for doing joins, and use INNER JOIN instead of SELECT FROM TABLE1, TABLE2, TABLE3 ...
makes it...
August 18, 2009 at 7:16 am
Viewing 15 posts - 631 through 645 (of 698 total)