select o.name as [Name], sc.name as [Type], s.row_count as [Size]
from sys.objects o
left join sys.schemas sc on sc.schema_id = o.schema_id
left join (select object_id, sum(rows) as row_count from sys.partitions
where index_id < 2
group by object_id) s on o.object_id = s.object_id
where o.type = 'U'
order by sc.name, o.name
Translate
Thursday, 30 October 2014
Using SQL Server Metadata and Statistics to Build a Table
Extract Table Meta Data (description, fields and their data types)
SELECT u.name + '.' + t.name AS [table],
td.value AS [table_desc],
c.name AS [column],
cd.value AS [column_desc]
FROM sysobjects t
INNER JOIN sysusers u
ON u.uid = t.uid
LEFT OUTER JOIN sys.extended_properties td
ON td.major_id = t.id
AND td.minor_id = 0
AND td.name = 'MS_Description'
INNER JOIN syscolumns c
ON c.id = t.id
LEFT OUTER JOIN sys.extended_properties cd
ON cd.major_id = c.id
AND cd.minor_id = c.colid
AND cd.name = 'MS_Description'
WHERE t.type = 'u'
ORDER BY t.name, c.colorder
Monday, 27 October 2014
Convert the XML to temp table using OPENXML in SQL Server
DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc ='
<OutLookContact>
<Contact FirstName="Asif" LastName="Ghafoor" EmailAddress1="asifghafoor@my. web.pk" />
<Contact FirstName="Rameez" LastName="Ali" EmailAddress1="rameezali@my. web.pk" />
</OutLookContact>'
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
DECLARE @Temp TABLE(FirstName VARCHAR(250),LastName VARCHAR(250),Email1 VARCHAR(250))
INSERT INTO @Temp(FirstName,LastName, Email1)
SELECT *
FROM OPENXML (@idoc, '/OutLookContact/Contact',1)
WITH (FirstName varchar(50),LastName varchar(50),EmailAddress1 varchar(50))
select FirstName,LastName,Email1 from @Temp
Monday, 20 October 2014
jQuery User Interface
References:
http://jqueryui.com/demos/
http://jqfundamentals.com/chapter/events
http://www.tutorialspoint.com/jquery/jquery-events.htm
http://www.itfunda.com/aspnet-how-to-tips-and-tricks/Show/50
http://www.dotnet-tricks.com/Tutorial/jquerylist
http://www.jeasyui.com/
http://jqueryui.com/dialog/
JSON:
http://forums.asp.net/t/1651515.aspx?call+C+function+using+json
AJAX Cascading dropdownlist using JQuery:
http://www.aspsnippets.com/Articles/AJAX-Cascading-DropDownList-using-jQuery-in-ASP.Net.aspx
http://jqueryui.com/demos/
http://jqfundamentals.com/chapter/events
http://www.tutorialspoint.com/jquery/jquery-events.htm
http://www.itfunda.com/aspnet-how-to-tips-and-tricks/Show/50
http://www.dotnet-tricks.com/Tutorial/jquerylist
http://www.jeasyui.com/
http://jqueryui.com/dialog/
JSON:
http://forums.asp.net/t/1651515.aspx?call+C+function+using+json
AJAX Cascading dropdownlist using JQuery:
http://www.aspsnippets.com/Articles/AJAX-Cascading-DropDownList-using-jQuery-in-ASP.Net.aspx
Monday, 13 October 2014
Friday, 10 October 2014
How to make sql query result to xml file
Method 1:
SELECT *
FROM dbo.YourStudentTable
FOR XML PATH('Student'), ROOT ('Students')
Method 2:
DECLARE @x xml
SET @x=( SELECT *
FROM dbo.YourStudentTable FOR XML RAW, TYPE,ROOT('myRoot'))
SELECT @x
Method 3:
SELECT * from dbo.YourStudentTable
FOR XML RAW ('Employee'), ROOT ('Employees'), ELEMENTS XSINIL;
SELECT *
FROM dbo.YourStudentTable
FOR XML PATH('Student'), ROOT ('Students')
Method 2:
DECLARE @x xml
SET @x=( SELECT *
FROM dbo.YourStudentTable FOR XML RAW, TYPE,ROOT('myRoot'))
SELECT @x
Method 3:
SELECT * from dbo.YourStudentTable
FOR XML RAW ('Employee'), ROOT ('Employees'), ELEMENTS XSINIL;
Wednesday, 8 October 2014
Basic English Listening Lessons
Basic English Listening Lessons
http://www.talkenglish.com/Listening/ListenBasic.aspx
http://www.englishinuse.net/
Short Stories:
http://www.english-for-students.com/Short-Stories.htmlStories
http://www.english-for-students.com/Simple-Short-Stories.html
Work on this:
http://www.tolearnenglish.com/english_lessons/simple-english-stories
Online Writing Support
http://www.towson.edu/ows/index.asp
Reading
http://www.englishforeveryone.org/Topics/Reading-Comprehension.htm
http://www.muskingum.edu/~cal/database/general/reading.html
http://www.worldstories.org.uk/stories/stories?lang=tamil
Listening
http://www.learnenglishfeelgood.com/eslvideo/
http://esl.about.com/od/listeningquizzes/
English_Listening_Comprehension_Quizzes_for_ESL_EFL.htm
Speaking
http://www.talkenglish.com/
http://www.englishleap.com/other-resources/spoken-english-tips
http://www.focusenglish.com/dialogues/conversation.html
Frequently Used Sentences in English:
http://www.english-for-students.com/Frequently-Used-Sentences.html
Practical Dialogue:
https://www.agendaweb.org/listening/practical-english-conversations.html
http://www.focusenglish.com/dialogues/communication/commindex.html
http://www.talkenglish.com/Listening/ListenBasic.aspx
http://www.englishinuse.net/
Short Stories:
http://www.english-for-students.com/Short-Stories.htmlStories
http://www.english-for-students.com/Simple-Short-Stories.html
Work on this:
http://www.tolearnenglish.com/english_lessons/simple-english-stories
Online Writing Support
http://www.towson.edu/ows/index.asp
Reading
http://www.englishforeveryone.org/Topics/Reading-Comprehension.htm
http://www.muskingum.edu/~cal/database/general/reading.html
http://www.worldstories.org.uk/stories/stories?lang=tamil
Listening
http://www.learnenglishfeelgood.com/eslvideo/
http://esl.about.com/od/listeningquizzes/
English_Listening_Comprehension_Quizzes_for_ESL_EFL.htm
Speaking
http://www.talkenglish.com/
http://www.englishleap.com/other-resources/spoken-english-tips
http://www.focusenglish.com/dialogues/conversation.html
Frequently Used Sentences in English:
http://www.english-for-students.com/Frequently-Used-Sentences.html
Practical Dialogue:
https://www.agendaweb.org/listening/practical-english-conversations.html
http://www.focusenglish.com/dialogues/communication/commindex.html
Wednesday, 1 October 2014
Listing all tables in a database and their row counts in SQL Server
CREATE TABLE #counts
(
table_name varchar(255),
row_count int
)
EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #counts ORDER BY row_count DESC
(
table_name varchar(255),
row_count int
)
EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #counts ORDER BY row_count DESC
Subscribe to:
Posts (Atom)