Posts

Showing posts with the label column

SQL FINDING ALL THE TABLE NAME COLUMN NAME WHICH HAVING IDENTITY FIELD AUTO INCREMENT

SQL FINDING ALL THE TABLE NAME COLUMN NAME WHICH HAVING IDENTITY FIELD AUTO INCREMENT --FINDING ALL THE TABLE NAME & COLUMN NAME WHICH IDENTITY IS ON(1) SELECT C.NAME AS COLNAME,T.NAME AS TABLENAME,C.IS_IDENTITY FROM SYS.COLUMNS C INNER JOIN SYS.TABLES T ON C.OBJECT_ID=T.OBJECT_ID WHERE C.IS_IDENTITY=1 This post h download  file  now

SQL Rename Column or Tables Use of SP RENAME

SQL Rename Column or Tables Use of SP RENAME --Rename a Column Name replacing Old_Name EXEC SP_RENAME TABLE_NAME.COLUMN_NAME,COLUMN_NAME,COLUMN OR SP_RENAME TABLE_NAME.COLUMN_NAME,COLUMN_NAME,COLUMN ALTER TABLE Employee ALTER COLUMN download  file  now

Stacked column charts with Google charts compared to gnuplot

Stacked column charts with Google charts compared to gnuplot Some time ago I had written about stacked histograms in gnuplot. Today I wanted to see how to achieve the same result with Google charts. For the purpose of this first exercise I was using the client side only and didnt worry about where the data should or could come from (in gnuplot data came from a file, naturally) but I put them directly into the JavaScript code. So first take a look at the result. As you can see the charts are pretty similar to gnuplot. There is currently one caveat in Google charts where you cant have multiline titles so its displayed as one line. So here is the JavaScript code. The code is a slight modification of the Google charts column chart example and of course the calculation of the percentages for the second chart is the only piece where some real additional work is required. I left all settings at their defaults (like colours, fonts etc.) except for the obvious y-axis title and...

SQL Adding IDENITY property to Existing Column

SQL Adding IDENITY property to Existing Column --Adding IDENITY property to Existing Column --Steps to Add Identity 1.Add new Column with IDENTITY 2.Drop Constraint (if Any) 3.Drop the Old Column 4.Rename the New Column with Old Column Name --Existing Table download  file  now

SQL Function for finding Number of Column in a Given Table

SQL Function for finding Number of Column in a Given Table Below a function which can be used to find the no.of column in a specified Table.This function returns an INT(Scalar Value).This Type of function is known as scalar valued function. --FUNCTION FOR FINDING NO OF COLUMN FROM GIVEN TABLE --Create a function with Table_Name as Parameter CREATE FUNCTION FUN_COL_COUNT(@T_NAME VARCHAR(50)) RETURNS INT AS BEGIN DECLARE @CNT INT SELECT @CNT=MAX(ORDINAL_POSITION) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=@T_NAME RETURN @CNT END --Run the Function SELECT DBO.FUN_COL_COUNT(Table_name) This above statement return the no.of column in the Table_name .Here DBO represents DataBase Object(Schema).More about Schema read some other articles/Posts. Here Information schema views provide an internal, system table-independent view of the SQL Server metadata. Information schema views enable applications to work correctly although significant changes have been made to the underlying system tables...