If your RS parameter is set to a string, the original
> "convert(datetime,period,105)" should give you the listing you desire.
When
> this parameter is then passed to SQL it "should" automatically be
recognized
> as a date, but if not, you could pass the parameter as as string, and then
> declare and set a new SQL parameter to the cast(@.param as datetime).
This doesn't seem to work, if I set it to string and do the convert it still
shows the time.
I'm trying to do it the other way around but get syntax error, what could be
wrong here:
CREATE FUNCTION udf_MyDate (@.indate datetime, @.separator char(1))
RETURNS Nchar(20)
AS
BEGIN
RETURN
CONVERT(Nvarchar(20), datepart(mm,@.indate))
+ @.separator
+ CONVERT(Nvarchar(20), datepart(dd, @.indate))
+ @.separator
+ CONVERT(Nvarchar(20), datepart(yy, @.indate))
END
GO
SELECT DISTINCT PERIODESTART, DAY(PERIODESTART) AS Expr1, [dbo].[udf_MyDate]
(periodestart,'/') AS pstart
FROM DEBSTAT
WHERE (DAY(PERIODESTART) <> '31')
ORDER BY PERIODESTART
DROP FUNCTION [dbo].[udf_MyDate]
JackJack, recommend you check Books on Line. Here's what it says:"Using CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )"
Style is very useful here; you may need to experiment with it until you get
the output you want. By using this, you won't need a function. You can use
the convert statement in your query.
I hope this helps you.
Henry Robinette
"Jack Nielsen" wrote:
> If your RS parameter is set to a string, the original
> > "convert(datetime,period,105)" should give you the listing you desire.
> When
> > this parameter is then passed to SQL it "should" automatically be
> recognized
> > as a date, but if not, you could pass the parameter as as string, and then
> > declare and set a new SQL parameter to the cast(@.param as datetime).
> This doesn't seem to work, if I set it to string and do the convert it still
> shows the time.
> I'm trying to do it the other way around but get syntax error, what could be
> wrong here:
> CREATE FUNCTION udf_MyDate (@.indate datetime, @.separator char(1))
> RETURNS Nchar(20)
> AS
> BEGIN
> RETURN
> CONVERT(Nvarchar(20), datepart(mm,@.indate))
> + @.separator
> + CONVERT(Nvarchar(20), datepart(dd, @.indate))
> + @.separator
> + CONVERT(Nvarchar(20), datepart(yy, @.indate))
> END
> GO
> SELECT DISTINCT PERIODESTART, DAY(PERIODESTART) AS Expr1, [dbo].[udf_MyDate]
> (periodestart,'/') AS pstart
> FROM DEBSTAT
> WHERE (DAY(PERIODESTART) <> '31')
> ORDER BY PERIODESTART
> DROP FUNCTION [dbo].[udf_MyDate]
> Jack
>
>
2012年2月23日星期四
2012年2月16日星期四
Any free sql backup compression utility ?
Hi,
I perform backup by maintenance plan tasks and think about add additional
task to compress backups and delete original backups.
Do you know some script base resolution (winzip, winrar, 7zip...)?
Regards,
anxcomp
From what I understand there is a command line version of winzip. But that
does not give you the same thing as using one of the tools from Red-gate or
Quest. They compress the backup as it is being read and when written it is
already compress. You would have to do it in two steps and it would require
much more CPU & Disk I/O than with Red-Gate. Not to mention you now have to
have extra disk space to store the initial backup before you compress it.
The same is true for restores. It makes the process much longer and more
difficult than it needs to be.
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"anxcomp" <anxcomp@.discussions.microsoft.com> wrote in message
news:F6756C86-51F1-4344-85ED-A20ADA7E32F8@.microsoft.com...
> Hi,
> I perform backup by maintenance plan tasks and think about add additional
> task to compress backups and delete original backups.
> Do you know some script base resolution (winzip, winrar, 7zip...)?
> --
> Regards,
> anxcomp
|||Hello,
This is good for me, I don't want live compression and decompression. My
databases are on simple mode I perform only full nightly backup.
Do you use some scripts (vbs, sql with xp_cmdshell or something...) to
perform this task?
Thank you inadvice
Regards,
anxcomp
|||What does the fact this is in simple mode have to do with this? In any case
have a look here:
http://www.winzip.com/prodpagecl.htm
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"anxcomp" <anxcomp@.discussions.microsoft.com> wrote in message
news:6195075F-3BB9-4D62-8088-A107309DC75E@.microsoft.com...
> Hello,
> This is good for me, I don't want live compression and decompression. My
> databases are on simple mode I perform only full nightly backup.
> Do you use some scripts (vbs, sql with xp_cmdshell or something...) to
> perform this task?
> Thank you inadvice
> --
> Regards,
> anxcomp
I perform backup by maintenance plan tasks and think about add additional
task to compress backups and delete original backups.
Do you know some script base resolution (winzip, winrar, 7zip...)?
Regards,
anxcomp
From what I understand there is a command line version of winzip. But that
does not give you the same thing as using one of the tools from Red-gate or
Quest. They compress the backup as it is being read and when written it is
already compress. You would have to do it in two steps and it would require
much more CPU & Disk I/O than with Red-Gate. Not to mention you now have to
have extra disk space to store the initial backup before you compress it.
The same is true for restores. It makes the process much longer and more
difficult than it needs to be.
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"anxcomp" <anxcomp@.discussions.microsoft.com> wrote in message
news:F6756C86-51F1-4344-85ED-A20ADA7E32F8@.microsoft.com...
> Hi,
> I perform backup by maintenance plan tasks and think about add additional
> task to compress backups and delete original backups.
> Do you know some script base resolution (winzip, winrar, 7zip...)?
> --
> Regards,
> anxcomp
|||Hello,
This is good for me, I don't want live compression and decompression. My
databases are on simple mode I perform only full nightly backup.
Do you use some scripts (vbs, sql with xp_cmdshell or something...) to
perform this task?
Thank you inadvice
Regards,
anxcomp
|||What does the fact this is in simple mode have to do with this? In any case
have a look here:
http://www.winzip.com/prodpagecl.htm
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"anxcomp" <anxcomp@.discussions.microsoft.com> wrote in message
news:6195075F-3BB9-4D62-8088-A107309DC75E@.microsoft.com...
> Hello,
> This is good for me, I don't want live compression and decompression. My
> databases are on simple mode I perform only full nightly backup.
> Do you use some scripts (vbs, sql with xp_cmdshell or something...) to
> perform this task?
> Thank you inadvice
> --
> Regards,
> anxcomp
订阅:
博文 (Atom)