Viewing 15 posts - 1 through 15 (of 21 total)
If you can use the user defined function, you can try this solution....
1. Define a function
-------------------------------------------------
CREATE FUNCTION dbo.spGetList
(
@Empid varchar(10)
)
RETURNS varchar(100) AS
BEGIN
declare @list varchar(100)
set @list=''
select @list=@list+ ','+ Phno from...
July 16, 2004 at 10:00 am
Try this.....
insert into table_reports
select distinct t1.user_id,t2.report_name,t2.descr from table_reports t1 cross join table_reports t2
where t1.user_id+t2.report_name not in (select distinct user_id+report_name from table_reports)
July 13, 2004 at 2:55 pm
You can try (this works, if stage is not in sequence)
update tempdata set end_date=(select start_date from tempdata t2
where t2.svc_id=tempdata.svc_id and t2.stage=(select min(stage) from tempdata t3 where t3.stage > tempdata.stage)
)
---...
June 21, 2004 at 2:01 pm
Try this:
CREATE Procedure sp_abc
(
@Userid int =0
 
As set nocount on
if @userid=0
Begin
Calculate data for all users
End
Else
Begin
Calculate...
June 15, 2004 at 8:56 am
Try this.....
select t1.Client_Rep ,t1.begin_work,max(t2.end_work) as workend,datediff(hour,max(t2.end_work),t1.begin_work)
as diff from tempdata t1
join tempdata t2 on t1.Client_Rep =t2.Client_Rep
where t1.begin_work > t2.end_work
group by t1.Client_Rep ,t1.begin_work
having datediff(hour,max(t2.end_work),t1.begin_work) > 1
June 14, 2004 at 1:44 pm
You can try this... (if your function returns "total")
Select Sum( dbo.TestSharesTable1( b.InvestID, @Count )  as total
From App_position b
Where b.portID = @PortID
June 10, 2004 at 2:57 pm
Try using
select * from Program where Executable = @Psuedo program
June 7, 2004 at 8:38 am
You can use dynamic sql
---------------------------
DECLARE
@CHAR VARCHAR(50),
@TCHAR VARCHAR(50),
@CHARLEN INT,
@BEGIN INT,
@END INT,
@Eventlist varchar(100),
@eventcount int,
@sql VARCHAR(5000),
@MYSQL VARCHAR(200)
SET @sql=''
set @eventlist=''
SELECT @EventLIST=@EventLIST+ISNULL(S.eventid,'')+',' FROM
(SELECT DISTINCT eventid FROM agentevents )...
June 4, 2004 at 8:55 am
Can you try ....
select p.perioidID, isnull(amount,0) from
Period p left outer join transactions t on p.periodid=t.periodid
It will be more helpful, if you can provide some sample data.
April 6, 2004 at 12:52 pm
Try this....
declare @traceid int
exec sp_trace_create @traceid output, 8
March 22, 2004 at 3:15 pm
What do u mean by "make this into one record" ? Can u exalain in detail how u want ur output to be?
June 2, 2003 at 9:58 am
I assumed that test table has values like this
testid elapsedtime ...
May 27, 2003 at 4:05 pm
In which format are u storing the data in Elapsedtime column. Is it exactly the way u mentioned- like h m s?
May 27, 2003 at 3:48 pm
I think this might help you.
declare @temp varchar(50),@sql varchar(100)
set @temp='5h 15m 35s'
set @sql='select '
set @sql=@sql + REPLACE(REPLACE(REPLACE(@temp, 'h ', ' * 3600 + '), 'm ',...
May 27, 2003 at 1:21 pm
Viewing 15 posts - 1 through 15 (of 21 total)