Viewing 15 posts - 346 through 360 (of 366 total)
This is adding a leading 0 when one is not needed
declare @thedate datetime
set @thedate = '4/25/05'
Select replace(Replace(Convert(Char(6),@thedate,109),' ','0'),' ','')
Returns
Apr025 which has a leading 0 when it is not needed
Thanks
Mike
April 25, 2005 at 8:51 pm
From previous post consider the following SQL statements and return values
Select Replace(Convert(Char(6),GetDate(),100),' ','') as 'Date1'
--Returns
--Apr25
Select Replace(Convert(Char(6),'4/25/05',100),' ','')as 'Date2'
--Returns
--4/25/0
Select Replace(Convert(Char(6),'04/25/05',100),' ','')as 'Date3'
--Returns
--04/25/
-- The next one works with GetDate(),
-- ignores leading trailing...
April 25, 2005 at 7:50 pm
Hi Jan, I am not quite sure what you are looking for. Are you selecting data from more than one table and if so what is the relationship between tables....
April 23, 2005 at 1:51 pm
Remi thanks. Just fuzzy thinking here in re-reading the original post I see that cartesian result is required. I must have a thing about requesting data that is not needed or creating...
April 21, 2005 at 10:30 am
Noeld, Remi thanks for your response. Now just one more question (I caught this just one more question habit from my kids.
April 21, 2005 at 9:57 am
I agree with Phill. Perhaps you are approaching the problem in the wrong manner. IMHO I would suggest:
1. Define the desired output
2. Determine the needed inputs
3. Forget the Orcal code
4....
April 21, 2005 at 5:50 am
Hi guys a quick question on the posts by Carl and Hariharan. First Carl's post uses a cross join without a where statement which will produce a Cartesian product of...
April 21, 2005 at 5:29 am
Frank the link you posted is broken, or at least on my machine it is broken.
Ed your quote is adapted from the Peter...
April 21, 2005 at 3:31 am
Trying to debug a script without knowing the business logic will turn your hair grey In my experience a quick, simple conversion of...
April 20, 2005 at 5:18 am
Phil, wierd is not the word I would have choosen as it is not descriptive enough.
Two quick questions. first have you run a...
April 19, 2005 at 5:30 am
I think the following select statement will give you what you want. There is a problem in that “count” does not include NULL values thus from the result...
April 17, 2005 at 11:12 am
Phil, I have been unable to replicate the behaviors you are describing.
My understanding from BOL is that Sp_databases reads the system...
April 16, 2005 at 5:31 pm
Phil, have you tried the following from BOL.
Lists databases that reside in the Microsoft® SQL Server™ installation or are accessible through a database gateway.
sp_databases
None
April 15, 2005 at 9:27 pm
Diederik, the problem with undoumented procedures is that they are undocumented and there is no Guarantee that the next sp or upgrade will not break the procedure. Been there done...
April 15, 2005 at 8:58 pm
Viewing 15 posts - 346 through 360 (of 366 total)