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:

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 

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...