Viewing 15 posts - 61 through 75 (of 568 total)
Hi ram,
In which format of the time you have?
7.30, 7:30, 7hours 30 min, so that its appears as 7:50
January 18, 2010 at 3:21 am
Hi,
The table schema haven’t the null, so that it’s happened some time,
Use the case statement to set this issue, like
select a.CID,a.trainingId,
(case when (a.nomFR = '') or (a.nomFR is null) then...
January 18, 2010 at 3:14 am
One of the options to get thro by OS level, log would capture in the MMC (Microsoft management console), in the event viewer, unless the disk clean up activity, the...
January 18, 2010 at 2:23 am
Hi,
Because the OP needs to get the unique identifier in every row insert!!!
January 18, 2010 at 1:19 am
Hi,
use the trigger to get the newid value
create table MYTABLE
(
col1 int,
col2 varchar (2)
)
CREATE trigger ins_trg_MYTABLE on MYTABLE
for INSERT
as
PRINT CONVERT(varchar(255), newid())
return
insert into MYTABLE
select 1,'A'
January 18, 2010 at 12:32 am
samirprogrammer (1/15/2010)
select * from tableA inner join tableB on tableA.id=tableB.id and tableA.date=(select max(date) from tableB where id=tableA.id)
Hi,
try this
select a.* from tableA a
inner join
(select id,max([date]) [date]
from tableB
group...
January 15, 2010 at 11:25 pm
Jeff Moden (1/15/2010)
Would you share with us why you want to do this unusual thing first?
Hi Jeff,
The OP needs to set the posted function (may created for another reason) to...
January 15, 2010 at 9:44 pm
Hi,
For the sub total, the rollup method is best to achieve,
Or use this simple statement
select * from MYTABLE
union all
select col1+' TOTAL',sum(col2),sum(col3),sum(Total) from MYTABLE
group by col1
order by col1
January 14, 2010 at 8:45 pm
sc-w (1/13/2010)
INSERT INTO wce_activity (uniqueid, createdate, reminderdate) VALUES ('"& (uid) &"','"& date() &"','" DATEADD(mm, + 1, GETDATE()) "')
Hi,
Try this
INSERT INTO wce_activity (uniqueid, createdate, reminderdate)
select user_id() ,getdate(),dateadd(m, 1, getdate())
or
INSERT...
January 13, 2010 at 3:37 am
Abhijeet Dighe (1/12/2010)
I need to generate a random 10 digit alphanumeric string that is also unique within a table.
Hi,
This @random string value is unique unless you pass...
January 13, 2010 at 2:38 am
Hi,
Unique string for the table/procedure
Declare @random varchar(10)
set @random = CONVERT(varchar(10), right(newid(),10))
apply this @random string in the table/procedure
January 13, 2010 at 2:14 am
Hi Abhijeet,
Big bucket mentioned code for random of the alphanumeric is fine, but not suit for the SQL 2000, you use the newid() to get the simple random like
select...
January 13, 2010 at 1:10 am
Hi,
Try to make all the four separate select statement in to one statement by using UNION operation. Like
Select 'Savings per Policy' as TYPE , subpolicy_name, SUM(CO2_savings) As total_savings
From #CO2temp
group...
January 12, 2010 at 3:59 am
--Today
SELECT convert(varchar(15),getdate(),103)
--Yesterday
SELECT convert(varchar(15),getdate()-1,103)
--LAST YEAR
SELECT convert(varchar(15),((dateadd(year,-1,getdate()-1))),103)
January 12, 2010 at 3:31 am
--Today
SELECT cast(convert(varchar(8),getdate(),1) as datetime)
--Yesterday
SELECT cast(convert(varchar(8),getdate()-1,1) as datetime)
--LAST YEAR
SELECT cast(convert(varchar(8),(dateadd(year,-1,getdate()-1)),1) as datetime)
--Today
SELECT DATEADD(day,DATEDIFF(day, 0, GETDATE()),0)
--Yesterday
SELECT DATEADD(day,DATEDIFF(day, 0, GETDATE()),-1)
--LAST YEAR
SELECT DATEADD(YEAR,-1,(DATEADD(day,DATEDIFF(day, 0, GETDATE()),-1)))
January 12, 2010 at 3:17 am
Viewing 15 posts - 61 through 75 (of 568 total)