If you want to know the size of your database table in bytes, use the below command.
Thursday, May 26, 2011
Saturday, April 23, 2011
T-SQL for finding SQL Server Version
SELECT
CAST(SERVERPROPERTY('ProductVersion') AS varchar(100)) + ' ' +
CAST(SERVERPROPERTY('Edition') AS varchar(100)) + ' ' +
CAST(SERVERPROPERTY('ProductLevel') AS varchar(100));
CAST(SERVERPROPERTY('ProductVersion') AS varchar(100)) + ' ' +
CAST(SERVERPROPERTY('Edition') AS varchar(100)) + ' ' +
CAST(SERVERPROPERTY('ProductLevel') AS varchar(100));
Friday, March 25, 2011
GETDATE() to get only date in sql
To get only the date from T-SQL GETDATE() function (excluding the time part)
Example Query:
Example Query:
Select * From Employee Where JoinDate = Convert(Date, GETDATE())
Thursday, March 10, 2011
Code Formatter
Excellent online code formatter for C#, VB, T-Sql. Yes, it's FREE http://www.manoli.net/csharpformat/
Size of the database tables
I came across this wonderful t-sql script which displays the size of all the tables in a SQL Server Database. Thanks to Vidhya Sagar
SELECT 'Database Name: ', Db_name()
SET nocount ON
IF EXISTS(SELECT name
FROM tempdb..sysobjects
WHERE name = '##tmp')
DROP TABLE ##tmp
CREATE TABLE ##tmp
(
nam VARCHAR(50),
ROWS INT,
res VARCHAR(15),
data VARCHAR(15),
ind_sze VARCHAR(15),
unsed VARCHAR(15)
)
GO
DECLARE @tblname VARCHAR(50)
DECLARE tblname CURSOR FOR
SELECT name
FROM sysobjects
WHERE xtype = 'U'
OPEN tblname
FETCH NEXT FROM tblname INTO @tblname
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO ##tmp
EXEC Sp_spaceused @tblname
FETCH NEXT FROM tblname INTO @tblname
END
CLOSE tblname
DEALLOCATE tblname
GO
SELECT nam table_name,
ROWS total_rows,
res total_table_size,
data data_size,
ind_sze index_size,
unsed unused_space
FROM ##tmp
DROP TABLE ##tmp
Saturday, January 8, 2011
Secure your web.config file
ScottGu has an excellent article on the latest ASP.NET Security vulnerability and a hacker could download your web.config file which may contain sensitive data. Solution is to include a simple "CustomError" section. Read more
NTFS Permission using Command Prompt and .NET Framework Class Library
To provide NTFS Permission to any file using the Command Prompt, here is the command
CACLS "C:\test.bat" /e /p EveryOne:f
The above command gives "Full" permission to the file "test.bat" for "EveryOne" user
For more info, visit http://technet.microsoft.com/en-us/library/bb490872.aspx
VB.NET code for the same,
Imports System.IO
Imports System.Security.AccessControl
Dim fSecurity As FileSecurity
fSecurity = File.GetAccessControl(fileName)
fSecurity.AddAccessRule(New FileSystemAccessRule("EveryOne", FileSystemRights.Write, AccessControlType.Allow))
File.SetAccessControl(fileName, fSecurity)
Subscribe to:
Posts (Atom)
Github Actions - CI/CD for React.js
1. Install gh-pages npm package Command: npm install gh-pages --save-dev 2. In package.json, add the homepage url "homepage": &q...
-
Constructor is called when the class is instantiated. It is a good place to initialize class properties and inject dependencies. ngOnIni...
-
Add Visual Studio solution to Github using command line git init git add . git commit -m "Initial commit" git config --glo...
-
Needs storage account for creating Azure function Runtime stack can be .net, java, node.js etc Azure Functions can be hosted as Consumption...