Viewing 15 posts - 1,951 through 1,965 (of 3,008 total)
You should read about the restore command in SQL Server 2005 Books Online.
http://msdn.microsoft.com/en-us/library/ms178615(SQL.90).aspx
March 12, 2009 at 12:14 pm
It would be much simpler if you just stored that actual start and end times as datetime datatypes as the actual start datetime and end datetime. Then is is...
March 12, 2009 at 10:37 am
Another variation from Lynn's version:
;with
a1 as (
select 1 as N union all select 1 union all select 1 union all select 1 union all
select 1 union all select 1 union...
March 12, 2009 at 9:18 am
When you do a backup with append, you are writing a new backup set to the end of the same file. When you restored you probably did not specify...
March 12, 2009 at 8:09 am
I think this illustrates the problem with the OP picking the best solution:
http://www.sqlservercentral.com/Forums/Topic673876-1291-1.aspx
The best solution is debateable in this situation, but I doubt the OP was really able to judge...
March 12, 2009 at 7:38 am
AFIFM (3/12/2009)
...The sample code by Michael also does the job nicely except that it will only generates 5 characters string and I need 64 chracters.
I just assumed you would be...
March 12, 2009 at 7:29 am
The account that xp_cmdshell is running under will have to have permission to delete the file.
xp_cmdshell runs under the SQL Server service account if it is executed by a sysadmin...
March 11, 2009 at 10:46 pm
select
Random_String =
substring(x,(abs(checksum(newid()))%36)+1,1)+
substring(x,(abs(checksum(newid()))%36)+1,1)+
substring(x,(abs(checksum(newid()))%36)+1,1)+
substring(x,(abs(checksum(newid()))%36)+1,1)+
/* and so on for as many characters as needed */
substring(x,(abs(checksum(newid()))%36)+1,1)
from
(select x='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') a
Results: ...
March 11, 2009 at 10:42 pm
Bruce W Cassidy (3/11/2009)
March 11, 2009 at 2:53 pm
The last one (For rounding off to the nearest minute) does not work for the entire range of datetime. I have posted a more general method below.
print 'Limited start...
March 11, 2009 at 1:23 pm
Luke L (3/11/2009)
March 11, 2009 at 12:17 pm
The code below is the standard way to get a date without the time in SQL Server.
Extensive testing (by me and many others) has shown that casting a date...
March 11, 2009 at 10:23 am
select
*
from
MyTable
where
-- Date greater than or equal to Monday of last week
MyDate >= dateadd(dd,((datediff(dd,'17530101',getdate())/7)*7)-7,'17530101')
and
-- Date before Saturday of last week
Mydate < dateadd(dd,((datediff(dd,'17530101',getdate())/7)*7)-2,'17530101')
March 11, 2009 at 10:07 am
Shorter.
select [Month] = right(100+month(getdate()),2)
Results:
Month
-----
03
March 11, 2009 at 7:33 am
Viewing 15 posts - 1,951 through 1,965 (of 3,008 total)