Saturday 30 April 2016

MVC - Javascript - Select item in select list (dropdownlist) by text

Watch this example on YouTube


<select id="ddlID">
    <option value="0">blue</option>
    <option value="0">yellow</option>
    <option value="0">green</option>
</select>

@section Scripts{
<script type="text/javascript">

        $("#ddlID option").filter(function () {
            return $(this).text().trim() == "yellow";
        }).prop('selected', true);

</script>
}

MSSQL - Query to change int to bigint

Watch this example on YouTube:

Alter table Customers2 alter Column CustomerID bigint

MSSQL - Add leading zeros (0) to the integer

Watch this example on YouTube

Here I will add up to 20 zeros

SELECT  replicate ( '0', 20- len([CustomerID])) + cast (CustomerID as varchar(50)) as accNum
  FROM [TEST].[dbo].[Customers]