Viewing 15 posts - 196 through 210 (of 568 total)
karthimca07 (10/31/2009)
for example if 10 items purchased i looped it and SP called for 10 times.
Hi,
Unless see your code, it’s hard to advice!, Post your...
October 31, 2009 at 12:47 am
sql2000-915039 (10/30/2009)
I need t-sql to display only those rows with the most recent date.
select name,max(date),max(col1)...
from MYTABLE
GROUP BY name
October 30, 2009 at 9:41 pm
Hi,
Along with Gianluca nice approaches also try this
Use Gianluca sample data
select a.SalesCode,
a.SalesRep,
max(a.Dept) [From],
max(b.Dept) [TO],
min(a.JoinDt),
max(b.JoinDt)TransferDt
from @Transfers a ,
@Transfers b
where a.TransferDt is not null
and a.SalesCode = b.SalesCode
and a.SalesRep = a.SalesRep
and...
October 27, 2009 at 3:42 am
Hi,
Assumption of min value among the columns in the each row
try this
declare @A123 table
(
ID int,
col1 int,
col2 int,
col3 int
)
insert into @A123
SELECT 1, 1, 2, 3
UNION
SELECT 2, 6,...
October 27, 2009 at 1:21 am
GilaMonster (10/26/2009)
October 26, 2009 at 4:56 am
Hi Gail,
Thanks, but the results vary by set nocount on/off
CREATE PROCEDURE TestRowCount AS
begin
SELECT * FROm sysobjects
end
GO
EXEC TestRowCount
SELECT @@RowCount
RESULT
some rows and
row count = 2170
alter PROCEDURE...
October 26, 2009 at 3:34 am
Hi,
The same method mentioned by bit bucket
Exec Get_Name 'Usa'
Select @@rowcount
Ensure that, your procedure should not having/use of SET NOCOUNT ON/OFF
.
October 26, 2009 at 2:47 am
manikandan-1115962 (10/24/2009)
yes i need to raise error of date range exceeds more than 1 year from start date
01)
declare @stdate datetime,@todate datetime
set @stdate = '2009-01-10'
set @todate = '2009-10-10'
if datediff(year,@stdate,@todate)<= 1
begin
insert mytable
....
....
end
else
begin
print'DATE...
October 24, 2009 at 5:14 am
manikandan-1115962 (10/24/2009)
End Date should not greater than 1 year from start date..
Ex.. Start date: 01.04.2009
End...
October 24, 2009 at 4:32 am
Krasavita (10/22/2009)
How can I right code that I want every 100 records to commit?
Try this
set rowcount 100
begin tran
update MYTABLE
set COL1 = 'COL1'
where COL1 = 'COL2'
after found no error then commit...
October 22, 2009 at 9:53 pm
999baz (10/20/2009)
WHERE id = object_id(N'[ANZ].[dbo].[TableStage] ') AND
--type in (N'U'))
OBJECTPROPERTY(id, N'IsUserTable') = 1)
...
October 20, 2009 at 9:32 pm
select col1,col2,col3 into #TableB
from TableA
group by col1,col2,col3
having count(*)> 1
select * from #TableB
now the #TableB table having the duplicate data of the TableA
October 15, 2009 at 2:52 am
Try this
create table #temp
(
keys int,
users varchar(10),
addr varchar(50),
report varchar(50)
)
insert into #temp
select 1,'abc','add-1','rep-01'
union all
select 2,'abc','add-1','rep-01 rep-02'
union all
select 3,'bcd','add-2','rep-01'
union all
select 4,'bcd','add-2','rep-02'
union all
select 5,'cde','add-2','rep-01'
union all
select 6,'cde','add-2','rep-02'
select users,addr,report,
replace(report,'rep-01','') trims,
(case when ((replace(report,'rep-01',''))='') or ((replace(report,'rep-01','')) = report)...
October 15, 2009 at 2:36 am
In the BOL the definition for the case statement
Simple CASE function:
CASE input_expression
WHEN when_expression THEN result_expression
[ ...n...
October 13, 2009 at 9:29 pm
Hi mark,
The sample data may be like this
create table #temp
(
uid1 varchar(5),
col1 int,
col2 int
)
insert into #temp
select 'A',10,15
union all
select 'A',15,25
union all
select 'B',25,10
union all
select 'B',35,15
union all
select 'C',50,25
October 12, 2009 at 2:44 am
Viewing 15 posts - 196 through 210 (of 568 total)