Jump to content

Ms Sql Server Technology Discussions


9Pardhu

Recommended Posts

[b] Database details for Daily checks[/b]


Execute the query in query against master database.
You will get the details for all the databases.

[CODE]
if exists (select * from tempdb.sys.all_objects where name like '%#dbsize%')
drop table #dbsize
create table #dbsize
(Dbname varchar(30),dbstatus varchar(20),Recovery_Model varchar(10) default ('NA'), file_Size_MB decimal(20,2)default (0),Space_Used_MB decimal(20,2)default (0),Free_Space_MB decimal(20,2) default (0))
go

insert into #dbsize(Dbname,dbstatus,Recovery_Model,file_Size_MB,Space_Used_MB,Free_Space_MB)
exec sp_msforeachdb
'use [?];
select DB_NAME() AS DbName,
CONVERT(varchar(20),DatabasePropertyEx(''?'',''Status'')) ,
CONVERT(varchar(20),DatabasePropertyEx(''?'',''Recovery'')),
sum(size)/128.0 AS File_Size_MB,
sum(CAST(FILEPROPERTY(name, ''SpaceUsed'') AS INT))/128.0 as Space_Used_MB,
SUM( size)/128.0 - sum(CAST(FILEPROPERTY(name,''SpaceUsed'') AS INT))/128.0 AS Free_Space_MB
from sys.database_files where type=0 group by type'


[/CODE]

Link to comment
Share on other sites

Handling Errors in SQL Server 2012

[url="http://www.simple-talk.com/sql/database-administration/handling-errors-in-sql-server-2012/"]http://www.simple-talk.com/sql/database-administration/handling-errors-in-sql-server-2012/[/url]

Link to comment
Share on other sites

[b] SQL Server Execution Plans, Second Edition by Grant Fritchey[/b]

[url="http://www.simple-talk.com/redgatebooks/grantfritchey/eBOOK_SQLServerExecutionPlans_2Ed_G_Fritchey.pdf"]Free PDF download[/url]

Link to comment
Share on other sites

[b] [url="http://www.sqlservercentral.com/blogs/sqlstudies/2013/01/14/using-new-horizontalvertical-tab-groups/"]Using New Horizontal/Vertical Tab Groups[/url][/b]

Link to comment
Share on other sites

[quote name='Kaarthikeya' timestamp='1358379130' post='1303120448']
The TRY…CATCH construct cannot be used in a user-defined function.

Is it true?
[/quote]


[b]Answer: [/b]TRUE
[b]Explanation: [/b]This is true. A constraint with the try..catch syntax is that it is not allowed in functions. Please refer to [url="http://www.sqlservercentral.com/links/1427054/289873"]http://msdn.microsoft.com/en-us/library/ms175976(v=sql.90).aspx[/url]

Link to comment
Share on other sites

Sql server 2008 Install chessanuu windows 7 lo...Successful ga install wyyindhee....

Management studio kanepenchadam ledhuuu.....ento pro ardam kavadam ledhuu....

Plz evaraina cheppandee.....Installation lo emina pro aaa?

Link to comment
Share on other sites

I have a result set something similar to this:

ID Name Start_Date End_Date New_ID New_Name
101 XYZ 2008-04-09 2011-11-14 101 ABC
101 XYZ 2011-04-09 2020-12-31 201 DKC

ID comes from one Table and New_ID comes from another table. Also, two make relation between these two tables, I do have two other tables involved.

I would like to retrieve only the record that has the New_ID based on the Date.
I am using the following query:

[CODE]
SELECT a.ID, a.Name, Max(b.Start_Date), Max(b.End_Date), b.New_ID, b.New_Name
FROM Table1 a INNER JOIN Table2 c ON a.C_ID = c.ID
INNER JOIN Table3 d ON d.ID = c.D_ID
INNER JOIN Table4 b ON b.ID = d.B_ID
[/CODE]

Link to comment
Share on other sites

[quote name='bad__boy' timestamp='1358521635' post='1303130149']
Sql server 2008 Install chessanuu windows 7 lo...Successful ga install wyyindhee....

Management studio kanepenchadam ledhuuu.....ento pro ardam kavadam ledhuu....

Plz evaraina cheppandee.....Installation lo emina pro aaa?
[/quote]
server meeda na local PC na?

SQL Server Configuration Manager lo ki velli SQL Services unnayo ledo chudu

Link to comment
Share on other sites

[quote name='Kaarthikeya' timestamp='1358522227' post='1303130221']
server meeda na local PC na?

SQL Server Configuration Manager lo ki velli SQL Services unnayo ledo chudu
[/quote]

Na Local PC lo bhayya......Actual ga Uninstall chesesanu nenna.....so malli cheddam anukuntunnanuuu......

Link to comment
Share on other sites

[quote name='bad__boy' timestamp='1358522396' post='1303130237']

Na Local PC lo bhayya......Actual ga Uninstall chesesanu nenna.....so malli cheddam anukuntunnanuuu......
[/quote]
vaarini mari uninstall chesi SSMS kanapadatledu antunnava? :3D_Smiles: :15_3_321:

Link to comment
Share on other sites

[quote name='Kaarthikeya' timestamp='1358522755' post='1303130295']
vaarini mari uninstall chesi SSMS kanapadatledu antunnava? :3D_Smiles: :15_3_321:
[/quote]

First chusanu ba...adhe kanapadaledhuuu...so andukee installation emina pro vundho emo ane Uninstall chesanuuu

Link to comment
Share on other sites

[quote name='bad__boy' timestamp='1358522875' post='1303130307']
First chusanu ba...adhe kanapadaledhuuu...so andukee installation emina pro vundho emo ane Uninstall chesanuuu
[/quote]


install cheseappudu ea ea components intall cheyyalo aduguthadi anukuntaa..
i gueess akkada miss kotti untavvv....

Link to comment
Share on other sites

×
×
  • Create New...