Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Diff between t-sql 2K5 and 2K8

Author  Topic 

Big-O
Starting Member

1 Post

Posted - 2010-03-11 : 14:56:15
Using SSMS for sql Server 2008 dev version. I'm attempting to write a T-sql to return information about DB and log files. When I run the following SQL against a 2008 DB on SSMS 2008 it runs just find, showing me all datbases user and system. However when I run the same T-SQL againse a SQl Server 2005 instance from within my SSMS 2008, i get two errors, a date conversion and interger error.
SQL:
select CONVERT(char(40), SERVERPROPERTY('MachineName')) as HOSTNAME,
@@servername as InstanceName, a.name as DatabaseName,
mf.name as FileName, mf.physical_name as Location,
LEFT(mf.physical_name, 1) as Drive,
(((mf.size * 8192) / 1024) / 1024) as SizeMB,
CONVERT (date, GETDATE()) as Date
from sys.master_files mf, sys.databases a
Where a.database_id = mf.database_id;

Any ideas on what the differnce is between engines and T_sql, are welcomed

Big-O

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-11 : 15:13:23
The data type "DATE" is new in 2008 so you can't use it in 2005.
Correct that first and then maybe the other error is away? I don't know.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-11 : 15:36:35
I have tested it without that convert to date.
It runs without any errors on 2005.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -