Tuesday 7 May 2019


split the Data comma separated values into rows:

step :1 Create the Document_Master Table

CREATE TABLE [dbo].[Document_Master ](
[ID] [bigint] IDENTITY(1,1) ,
[CountryCode] [nvarchar](2),
[cityCode] [nvarchar](max) ,
[DocumentName] [nvarchar](50) ,
[DocumentURLPath] [nvarchar](250) ,
[DocumentPath] [nvarchar](250) ,
[status] [bit]  )
GO

step :2 Dump the temp Data into the table.


step :3 create the temp table.

drop table  #yourTable
DECLARE @yourTable TABLE(ID bigint,ContryCode nvarchar(2),cityCode NVARCHAR(max))
SELECT * INTO #yourTable
FROM ( SELECT ID,countryCode,cityCode   FROM Document_Master ) AS x
GO

step :4 use the CTE(common table expression) to split the data.

WITH CTE
AS
(
    SELECT   countryCode,
            [xml_val] = CAST('<t>' + REPLACE(cityCode,',','</t><t>') + '</t>' AS XML)
    FROM #yourTable
)

SELECT distinct    countryCode,
        cityCode = col.value('.','VARCHAR(max)')
FROM CTE
CROSS APPLY [xml_val].nodes('/t') CA(col)
 order by countryCode,cityCode asc


step : show the result.

Split the rows into comma separated values in sql server?

create table #user (username varchar(25))

insert into #user (username) values ('HARI')
insert into #user (username) values ('ravi')
insert into #user (username) values ('RAJU')

declare @tmp varchar(250)
SET @tmp = ''
select @tmp = @tmp + username + ', ' from #user

select SUBSTRING(@tmp, 0, LEN(@tmp))

Output:



Multiple selection in dropdown?
step 1: Download the below attachments.
1) jquery.multiselect.js
2) Multiselect.css

step 2:create the web page and place the below code.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script src="Scripts/jquery-3.3.1.min.js"></script>
    <script src="Scripts/jquery.multiselect.js"></script>
    <link href="CSS/jquery.multiselect.css" rel="stylesheet" />
    <script type="text/javascript">
        $(document).ready(function () {
             $('#fruits').multiselect({
                columns: 1,
                placeholder: 'Select fruits',
                search: true,
                searchOptions: {
                    'default': 'Search fruits'
                },
                selectAll: true
            });
        });     
    </script>
</head>
<body>
    <form id="form1" runat="server">
         <div class="row" style="margin-top:100px;">
            <div class="col-md-3">
                <div class="form-group" id="divCities">
                    <span>Select Fruits</span>
                    <select multiple="multiple" id="fruits" class="3col active">                       
                        <option value="Apple">Apple</option>
                        <option value="Banana">Banana</option>
                        <option value="Orange">Orange</option>
                        <option value="Grape">Grape</option>
                        <option value="mango">mango</option>
                    </select>                   
                </div>
            </div>
        </div> 
    </form>
</body>
</html>

step:3 run the page and check the output.

Top Agile Interview Questions & Answers

Top Agile Interview Questions & Answers 1. What is Agile Testing? The first question of agile interview question tests your k...