Viewing 15 posts - 1,381 through 1,395 (of 1,417 total)
Maybe you are trying to do something like:
DECLARE @t TABLE
-- or create a temp table
(
Policy_ProductId int not null primary key
,RowNum int identity not null )
INSERT @t (Policy_ProductId)
SELECT Policy_ProductId
FROM Policy_Product
INSERT INTO...
August 24, 2006 at 8:26 am
David,
WOW!
It took me 15 minutes to understand what you did. It is a lot more efficient than my approach.
All methods with their percentage of batch cost are below:
declare @t table
(
tDate...
August 23, 2006 at 8:45 am
Take the query:
select T.tDate as DateFrom
,isnull
(
(select min(tdate)
from @t T1
where T1.price <> T.price
and T1.tdate > T.tdate) - 1
, D.MaxTDate) as DateTo
,T.price
from @t T cross join
(
select min(T5.tdate),...
August 23, 2006 at 7:13 am
The select statements are only test data. You will have to adapt the query so it works on your table.
August 23, 2006 at 6:46 am
This is more efficient:
select T.tDate as DateFrom
,isnull
(
(select min(tdate)
from @t T1
where T1.price <> T.price
and T1.tdate > T.tdate) - 1
, D.MaxTDate) as DateTo
,T.price
from @t T cross join
(
select min(T5.tdate),...
August 23, 2006 at 3:11 am
Try something like:
select *
from dbo.Companies C
join dbo.Contacts E on C.companyId = E.companyId
where E.contactId = ( select min(E1.contactId)
from dbo.Contacts E1
where E1.companyID = C.companyID)
August 22, 2006 at 12:26 pm
There is probably a better way, but this seems to work.
declare @t table
(
tDate datetime not null primary key
,price int not null
)
insert @t
select '20070101', 100 union all
select '20070102', 100 union all
select...
August 22, 2006 at 11:38 am
try:
INSERT INTO my_table (comments,
sr_status,
sr_notes_count,
sr_activity_count,
last_updated_dt)
SELECT 'some input comments',
(SELECT max(status) FROM my_table_2 WHERE id = 123),
(SELECT count(*) FROM my_table_3 WHERE id = 123),
(SELECT count(*) FROM...
August 18, 2006 at 11:25 am
PW's approach is more efficient.
--test data
declare @t table
(
tName varchar(20) not null
,Event varchar(20) not null
,tTime datetime not null
)
-- 7.34% of cost
insert @t
select 'Name1', 'Start', convert(datetime, '8/16/06 8:00 AM', 0) union all
select...
August 18, 2006 at 10:57 am
--test data
declare @t table
(
tName varchar(20) not null
,Event varchar(20) not null
,tTime datetime not null)
insert @t
select 'Name1', 'Start', convert(datetime, '8/16/06 8:00 AM', 0) union all
select 'Name2', 'Start', convert(datetime, '8/16/06 8:15 AM', 0)...
August 18, 2006 at 10:33 am
Run the profiler on the bits of the application which do not work and see what is called just before they fail.
August 18, 2006 at 3:38 am
Your query looks like it should work. You could simplfy it by trying something like:
SELECT A.t_Code
FROM C_CODES A
LEFT JOIN Stories S ON S.story_dt BETWEEN '20060810 09:00' AND '20060810 10:00'
AND ' '...
August 18, 2006 at 3:15 am
Try:
alter database abcd
set recovery simple
use abcd
go
dbcc shrinkfile(abcd_log, 200)
-- if originally in full recovery, reset
alter database abcd
set recovery full
You will need to do a full backup afterwards.
August 17, 2006 at 8:44 am
Be careful with nulls but try something like:
select *
from dbo.Employees E
where not exists (select *
from dbo.ModuleLog L
where L.EmployeeName = E.EmployeeName
and L.DOB = E.DOB)
or
select E.*
from dbo.Employees E
left join dbo.ModuleLog L on...
August 14, 2006 at 9:39 am
I have never called an Oracle SP from T-SQL but you could try passing @status as an output parameter.
eg exec DEV..SYSADM.update_procedure @Username,@status OUTPUT
August 14, 2006 at 8:18 am
Viewing 15 posts - 1,381 through 1,395 (of 1,417 total)