Viewing 15 posts - 286 through 300 (of 337 total)
declare @STR varchar(50)='my invoice number 3688992'
declare @num varchar(max)=''
declare @value varchar(50)='456'
select @STR
select @num=@num+''+n from
(
select SUBSTRING(@str,number,1)n from master..spt_values
where number<LEN(@str)and type='P'
)T where n between '0' and '9'
select...
November 22, 2010 at 10:01 pm
keymoo (11/22/2010)
Thanks it doesn't give me the correct results for dates that are the same. Is there a tweak needed to do that?
Please post some sample data and expected result...
November 22, 2010 at 7:31 am
Jeff Moden (11/22/2010)
November 22, 2010 at 6:19 am
;with cte
as
(
select *,ROW_NUMBER()over(order by (select 1))-row_number()over(partition by winloss order by winloss)rid from
(
select
tradeDateTime,[tradeId]
, case when [profit] >=0 then 'W' else 'L' end as WinLoss
...
November 22, 2010 at 5:53 am
OR something like this
declare @StartDate datetime = '2010-11-22'
declare @EndDate datetime = '2010-12-22'
;with DateSequence
as
(
select @StartDate Date
union all
select Date+1 from DateSequence where Date<@EndDate...
November 22, 2010 at 4:31 am
jagirdba (11/20/2010)
Hi Folks,I am currently preparing for SQL DBA job interview. Can somebody please suggest a good book to study.
I would really appreciate it.
Thank you
I am appearing for an interview...
November 21, 2010 at 2:42 am
parivedamohan (11/20/2010)
I am new to the Database world.
I would be very happy if any body Normalize the below table, which is in First Normal Form (1NF).
Table:
CREATE...
November 21, 2010 at 1:45 am
DON'T cross post.
http://www.sqlservercentral.com/Forums/Topic1023904-391-1.aspx
November 20, 2010 at 4:31 am
Does not make sense to me...
Can't you just convert the data in uppercase in your application code or in reporting tool where you need to show it?
November 19, 2010 at 8:28 am
declare @val int
declare @tblname1 as varchar(50)
declare @tblname2 as varchar(50)
set @tblname1='tbl_00001'
set @tblname2='tblSt_00001'
exec(';with cte1
as
(
select line,Status_text,Zerox_ID from '+@tblname1+'
except
select line,Status_txt,Zerox_file_ID from '+@tblname2+'
except
select line,Status_txt,Zerox_file_ID from '+@tblname2+'
except
select line,Status_txt,Zerox_file_ID from '+@tblname2+'
)
select '...
November 18, 2010 at 10:57 pm
Something like this
select stuff('5490 1234 5678 9128',1,12,'************')
November 17, 2010 at 3:40 am
nageshp (11/17/2010)
SELECT CONVERT(DATETIME,((SELECT CONVERT (VARCHAR,GETDATE(),101))+' ' +(SELECT SUBSTRING (CONVERT(VARCHAR,GETDATE(),109),14,27 ))))Output
11/17/2010 2:01:51:833PM
Still am not able to remove the milliseconds as it should be below.
11/17/2010 2:01:51PM
select CONVERT(varchar(20),GETDATE(),120)
November 17, 2010 at 3:28 am
declare @Employeetable as table(ID int,Name varchar(20),
Age int,Country varchar(20),
Manager varchar(20),Status varchar(20));
insert @Employeetable
select 1,'Ravi',29,'IN','Anil','A'union
select 2,'Balaji',30,'IN','Siju','A'union
select 3,'Sanjeev',31,'IN','Venkat','A'
select ID,Name,Age,Value from
(
select * from @Employeetable)u
unpivot (Value for columns in (country,manager,status))v
November 17, 2010 at 3:26 am
So what should be the o/p when variable value is ALL?
November 17, 2010 at 2:35 am
Viewing 15 posts - 286 through 300 (of 337 total)