Posts

Solution to error - String was not recognized as a valid DateTime.                                                       or  Conversion from string "29/04/2020" to type 'Date' is not valid Save date in SQL DB Dim requestdate As String             requestdate = DateTime.ParseExact(txtfrom.Text, "dd/MM/yyyy", Nothing).ToString("yyyy/MM/dd") comm.Parameters.AddWithValue("@req_date", requestdate)

isnull check

isnull(production_name,'')

Show datetime value into DD/MM/YYYY

CONVERT(varchar(103),SUBMISSION_DATE,103) AS SUBMISSION_DATE

jQuery date picker

<style type="text/css">    .datepick {     background-color: #fff;     color: #222;     border: 1px solid #c4c4c4;     font-family: Arial,Helvetica,Sans-serif;     font-size: 90%; } .datepick-rtl {     direction: rtl; } .datepick-popup {     z-index: 1000; } .datepick-disable {     position: absolute;     z-index: 100;     background-color: white;     opacity: 0.5; } .datepick a {     color: #222;     text-decoration: none; } .datepick a.datepick-disabled {     color: #888;     cursor: auto; } .datepick button {     margin: 0.25em;     padding: 0.125em 0em;     background-color: #fcc;     border: none;     border-radius: 0.25em;     -moz-border-radius: 0.25em;     -webkit-border-radius: 0.25em;     font-weight: bold; } .datepick-nav, .datepick-ctrl {     float: left;     width: 100%;     background-color: #fff; } .datepick-ctrl {     background-color: #f4f4f4;     font-weight: bold; } .datepick-cmd {     width: 30%; } .datepick-cmd:hover {     background-color: #266DBB

Triggers

A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view. These triggers fire when any valid event is fired, regardless of whether or not any table rows are affected. CREATE TRIGGER trgInsert ON [dbo].[Employee_Test] FOR INSERT AS declare @empid int; declare @empname varchar ( 100 ); declare @empsal decimal ( 10 , 2 ); declare @audit_action varchar ( 100 ); select @empid=i.Emp_ID from inserted i; select @empname=i.Emp_Name from inserted i; select @empsal=i.Emp_Sal from inserted i; set @audit_action= ' Inserted Record -- After Insert Trigger.' ; insert into Employee_Test_Audit (Emp_ID,Emp_Name,Emp_Sal,Audit_Action,Audit_Timestamp) values (@empid,@empname,@empsal,@audit_action,getdate()); P

Difference Between Truncate and Delete

DELETE 1. DELETE is a DML Command. 2. DELETE statement is executed using a row lock, each row in the table is locked for deletion. 3. We can specify filters in where clause 4. It deletes specified data if where condition exists. 5. Delete activates a trigger because the operation are logged individually. 6. Slower than truncate because, it keeps logs. 7. Rollback is possible. TRUNCATE 1. TRUNCATE is a DDL command. 2. TRUNCATE TABLE always locks the table and page but not each row. 3. Cannot use Where Condition. 4. It Removes all the data. 5. TRUNCATE TABLE cannot activate a trigger because the operation does not log individual row deletions. 6. Faster in performance wise, because it doesn't keep any logs. 7. Rollback is not possible. DELETE and TRUNCATE both can be rolled back when used with TRANSACTION. If Transaction is done, means COMMITED, then we can not rollback TRUNCATE command, but we can still rollback DELETE command from LOG files, as DELETE write re