Skip to main content

Posts

Showing posts from September, 2016

DBCC CHECKTABLE

Checks the integrity of all the pages and structures that make up the table or indexed view. Syntax: DBCC CHECKTABLE ( table_name | view_name [ , { NOINDEX | index_id } |, { REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD } ] ) [ WITH { ALL_ERRORMSGS ] [ , EXTENDED_LOGICAL_CHECKS ] [ , NO_INFOMSGS ] [ , TABLOCK ] [ , ESTIMATEONLY ] [ , { PHYSICAL_ONLY | DATA_PURITY } ] [ , MAXDOP = number_of_processors ] } ] DBCC CHECKTABLE( 'Production.Product' )

DBCC Command (Database Consistency Checker) -Sql Server

Database Consistency Checker act as Database Console Commands give details in form of statistics about the SQL Server. They can be used for Maintenance of database, index, or file group. DBCC Commands can be used to perform validation operations on a database, table, index, catalog, file group, or allocation of database pages. Database Console Command statements are grouped into the following categories. Maintenance   :  Maintenance tasks on a database, index, or filegroup. Miscellaneous  :  Miscellaneous tasks such as enabling trace flags or removing a DLL from memory. Informational  :  Tasks that gather and display various types of information. Validation         :  Validation operations on a database, table, index, catalog, filegroup, or allocation of database pages. DBCC Internal Database Snapshot command  DBCC CHECKALLOC DBCC CHECKDB DBCC CHECKCATALOG DBCC CHECKFILEGROUP DBCC CHECKTABLE Progress Reporting for DBCC Commands DBCC T

Split a string to a table using T-SQL

  In this tutorial, I will create a utility function used for string split and return in a table. ALTER FUNCTION Splitstring_to_table ( @string NVARCHAR( MAX ), @ delimiter CHAR ( 1 ) ) RETURNS @ output TABLE ( id INT IDENTITY ( 1 , 1 ) PRIMARY KEY , data NVARCHAR( MAX ) ) BEGIN DECLARE @ start INT , @ end INT SELECT @ start = 1 , @ end = CHARINDEX(@ delimiter , @string) WHILE @ start < LEN(@string) + 1 BEGIN IF @ end = 0 SET @ end = LEN(@string) + 1 INSERT INTO @ output ( data ) VALUES ( SUBSTRING (@string, @ start , @ end - @ start )) SET @ start = @ end + 1 SET @ end = CHARINDEX(@ delimiter , @string, @ start ) END RETURN END push string to function, see result SELECT * FROM dbo.Splitstring_to_table( 'Bangladesh, America, German,' , ',' ) Charindex : In SQL Server (Transact-SQL), the CHARINDEX function

Generate HASH string with T-SQL -Sqlserver

Using   HASHBYTES   Generate HASH string : HASHBYTES ( '<algorithm>' , { @ input | 'input' } ) <algorithm>::= MD2 | MD4 | MD5 | SHA | SHA1 | SHA2_256 | SHA2_512   Algorithm  MD5:   SELECT   CONVERT ( VARCHAR (32),   HashBytes ( 'MD5' ,   'code-lake@blogspot.com' ),2) Output:   7A598B534FD42DF41F7725CAAD261DCB Algorithm SHA1:   SELECT CONVERT(VARCHAR(32), HashBytes('SHA1', 'code-lake@blogspot.com'),2) Output:   7141CCD5A09B915B8541D4E4C3DCD108 Reference: MSDN

SQL Server blocked access to procedure ‘sys.sp_OACreate’ of component ‘Ole Automation Procedures’

I am working on banking project. For migration purpose, I will call web service in store procedure and based on this response I will  process another task. Create a Procedure named WebserviceCall CREATE procedure WebserviceCall @ UsrID as varchar ( 50 ) , @ Password AS Varchar ( 50 ) , @ AccountNo AS Varchar ( 50 ) AS BEGIN DECLARE @ obj INT DECLARE @ ValorDeRegreso INT DECLARE @ sUrl VARCHAR ( 200 ) DECLARE @ response VARCHAR ( 8000 ) = 'Failed' DECLARE @ hr INT DECLARE @ src VARCHAR ( 255 ) DECLARE @ desc VARCHAR ( 255 ) BEGIN TRY SET @ sUrl = 'http://x.x.x.x/mtcwebservicetest/Service.asmx/GetSession?UserID=' +@ UsrID + '&Password=' +@ Password + '' ; EXEC sp_OACreate 'MSXML2.ServerXMLHttp' , @ obj out EXEC sp_OAMethod @ obj, 'open' , NULL , 'GET' , @ sUrl, false EXEC sp_OAMethod @ obj, 'send' --EXEC sp_OAGetProperty @obj,'responseText',@response out

How to Refresh/Reload a Page frequently or periodically

We can automatically webpage refresh/ reload with two ways. one of them is using HTML Meta Tag and another is Javascript. in this tutorial you can learn both technique. Using Meta Tag <!DOCTYPE html> <html class= "k-ff k-ff43" > <head> <meta http-equiv= "refresh" content= "10" /> </head> <body> <div class= "refressData" style= "border: 2px dotted red; margin-top:40px;" id= "refressData" > </div> <script> $( document ).ready( function () { var dateTime = 'Date: ' + new Date ().getDate() + '/' + new Date ().getMonth() + '/' + new Date ().getFullYear() + '/' + ' Time: ' + new Date ().getHours() + ": " + new Date ().getMinutes() + ':' + new Date ().getSeconds(); $( "#refressData" ).append(dateTime); }) </script> </h

How to show/ hide child element on mouse hover of parent element -CSS

In this tutorial, you learn how to show or hide child element of parent element. simply doing this with html and CSS. There are two DIV, child div contain two button controls and child div to keep in parent div. when parent div mouse hover action happened , child div will display .  let's try it …! <! DOCTYPE html > < html class ="k-ff k-ff43"> < head >     < title > Display element in hover </ title >     < style >         .parent {             min-height : 200px ;             min-width : 500px ;             padding : 20px ;         }         .child {             position : relative ;             float : right ;             top : 0px !important ;             left : 0px !important ;             padding : 5px ;             display : none ;             height : 45px ;              width : 200px ;             min-height : 40px ;             min-width : 40px ;         }         .par