http://aspsnippets.com/Articles/Implement-Password-Policy-using-Regular-Expressions-and-ASPNet-RegularExpression-Validator.aspx
Friday, 25 July 2014
Monday, 14 July 2014
delete duplicate records in sql
select * from employee
go
alter table employee add Id int Identity(1,1)
go
delete from employee where ID not in
(
select min(id) as ID from employee group by EmployeeID,Salary
)
go
alter table employee drop column Id
go
select * from employee
go
alter table employee add Id int Identity(1,1)
go
delete from employee where ID not in
(
select min(id) as ID from employee group by EmployeeID,Salary
)
go
alter table employee drop column Id
go
select * from employee
Wednesday, 9 July 2014
Tuesday, 8 July 2014
Validate and replace char using jqery
if (str.indexOf('\'') >= 0 && str.indexOf('"') >= 0) {
//do something
}
$('#txt_pname').keyup(function () {
var str = $('#txt_pname').val();
if (str.indexOf('"') >= 0) {
//do something
$('#txt_pname').val(str.replace('"', ''));
alert('Double quote (") not allow.');
}
});
Tuesday, 1 July 2014
Get comma secreted values
create table your_table(City_Code int,Post_Code nvarchar(10), Post_Code_Description nvarchar(10))
insert into your_table values(100,'A1','ABC')
insert into your_table values(100,'C8','XYZ')
insert into your_table values(100,'Z3','MNO')
insert into your_table values(200,'D4','LMN')
insert into your_table values(300,'E3','IJK')
insert into your_table values(300,'B9','RST')
SELECT City_Code,
Post_Code =
STUFF((SELECT ', ' + Post_Code
FROM your_table b
WHERE b.City_Code = a.City_Code
FOR XML PATH('')), 1, 2, '')
--,Post_Code_Description=
STUFF((SELECT ', ' + Post_Code_Description
FROM your_table b
WHERE b.City_Code = a.City_Code
FOR XML PATH('')), 1, 2, '')
FROM your_table a
GROUP BY City_Code
insert into your_table values(100,'A1','ABC')
insert into your_table values(100,'C8','XYZ')
insert into your_table values(100,'Z3','MNO')
insert into your_table values(200,'D4','LMN')
insert into your_table values(300,'E3','IJK')
insert into your_table values(300,'B9','RST')
SELECT City_Code,
Post_Code =
STUFF((SELECT ', ' + Post_Code
FROM your_table b
WHERE b.City_Code = a.City_Code
FOR XML PATH('')), 1, 2, '')
--,Post_Code_Description=
STUFF((SELECT ', ' + Post_Code_Description
FROM your_table b
WHERE b.City_Code = a.City_Code
FOR XML PATH('')), 1, 2, '')
FROM your_table a
GROUP BY City_Code
Subscribe to:
Posts (Atom)