Posts

SCOPE_IDENTITY() Vs @@ Identity Vs IDENT_CURRENT(tableName) in Sql Server

Image
Hi there, in this blog post i am going to discuss the basic differences between SCOPE_IDENTITY(), @@Identity and IDENT_CURRENT('tableName').                 Basically all these three are used to retrieve the last inserted identity value in different session and  different scope. Let's try to understand it in detail. SCOPE_IDENTITY() :   It returns the value of identity last inserted within same session and same scope. @@Identity : It is a global variable which returns the value of identity last inserted within same session but in any scope. IDENT_CURRENT('tableName') : It returns the value of identity last inserted in any session and in any scope. Now, i am pretty sure you are wondering about what this session and scope really menu in the above mentioned points.   So, let me clear the same with an example. First we need to create two different but simple table with having the following structure. create table tableA ( id int identity(1,1)

SQL Server Identity with different possible operation on it.

Image
Hello folks,       I dentity column is very common in database design when we want to add a column as id and auto increment by itself. Some time this same feature is known as auto increment in different database(e.g. MYSQL).  Basically id column is if set as identity(auto increment), is automatically managed and increased by itself when new record(s) are inserted. So, get started with creating a new table in sql server with identity column. Either you can use sql query for this, CREATE TABLE tbl_person ( id INT IDENTITY (1, 1) PRIMARY KEY, name VARCHAR (255) NOT NULL, ); or you can use sql server management studio tool for this. You can set identity option for a column as shown in above screenshot. Here, you can set initial seed(first parameter in sql query) and increment seed (second parameter in sql query). On Successfully creation of table if we try to insert identity column column field explicitly the MSSQL server throws an error stating

Email send in Magento 2

Image
In this blog post i am going to create a new module to send email form magento custom contat form 1. Create email_templates.xml file in app/code/Contact/Us/etc <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> <template id="send_email_email_template" label="Email Form" file="email_template.html" type="text" module="[Name_Space]_[Your_Module]" area="frontend"/> </config> 2. Create email_template.html in app/code/Contact/Us/view/frontend/email <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> <template id="send_email_email_template" label="Email Form" file=&quo

All in one post for magento 2.x installation and after installation troubleshoot for window users

Image
This blog is purely dedicated to window users who faced problem while installation or after installation with wamp server on windows. * 500 internal server error while navigating to magento root folder from browser   A quick solution to this is 500 Internal Server Error when installing magento2.x on windows is navigate to  httpd.conf   file of apache server, and search for this line   LoadModule version_module modules/mod_version.so you find # just before above line denoting that it is commented, you just have to uncomment this to load the required module on server, restart all services of your wamp. you may find your installation on browser now works fine. * After successfully installation of magento you may find this exception  Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/wamp64/www/mage23/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: '