Both are different yet confused most of the times. Coalesce() takes a list of values and returns the first non-null value. If there is no non-null value,it will return the null value whereas nullif() takes two values and returns the first value. If both values are equal, it returns null. See this example to understand in detail.
Dropdown not getting bind using .val() and giving value in alert as null.
Nooper posted this problem and since we are not familiar with the context in which she is facing the problem we can give generic solutions to what we understand from the problem description: If you want to show the selected value in alert box, you can do it like this: alert($("#ddlGender option:selected").val()); This will show... Continue Reading →
SQL Aliasing
SQL Aliases SQL aliases are actually temporary names given to tables or a column or columns in a table. They do not actually create a new column in the database, but are the temporary readable names given to columns or tables for the time of the execution of the query. So, they only exists for... Continue Reading →
SQL Stored Procedure to select data based on conditions
Solution As we know a simple SQL select statement goes like this: select column_names from table_name Now, If we want to add a condition to selected records based on a single value of a column, we use where clause select column_names from table_name where column_value=value Example USE [DB_Name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER... Continue Reading →
SQL stored procedure to delete a specific record based on id
Solution USE [DB_Name] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_DeleteMember] @Id as bigint AS BEGIN SET NOCOUNT ON; Delete from Members_Table where ID = @Id END Explanation This delete stored procedure will delete the member from Members_Table whose member id is passed.
Get id of selected dropdown value in jquery
Solution var selectedid=$("#dropdownname").find('option:selected').attr('id'); Explanation This will find the id of selected dropdown option and store it in the variable selectedid.
Javascript function to calculate age from date of birth entered in a text box
Solution function calculateAge() { var dob = $('#DateOfBirth').val(); dob = new Date(dob); var today = new Date(); var age = Math.floor((today - dob) / (365.25 * 24 * 60 * 60 * 1000)); $('#Age').val(age); } Explanation dob will get the date of birth from DateOfBirth text box. It will convert it into date so to... Continue Reading →