-
Check subcategory id with main category using check constraint
Some time we have to insert in a foreign key reference table where we have to check subcategory id along with main category id for that we can use…
-
How to add hour and format datetime in moment js
var DprtforScn = new Date($(“#DateOfService”).val() + ‘ ‘ + $(“#StartTime”).val()); //alert(DprtforScn); var mday = moment(’11:28 PM’,’hh:mm a’); mday.add(1, ‘hours’) //alert(mday.format(‘hh:mm a’)); $(‘#EndTime’).val(mday.format(‘hh:mm a’));
-
select last child passing by parent id sql server
ALTER function [dbo].[fn_LastChild_Select] ( @ParentId int ) returns int as BEGIN Declare @childid int Declare @Id int SET @Id=@ParentId WHILE EXISTS(select * from dbo.miscDemographics_Relation where miscDemographics_MasterId=@ParentId) BEGIN SELECT @ParentId=miscDemographics_Id,@childid=miscDemographics_Id…
-
Insert into where no exist
INSERT INTO dbo.miscDemographics_Relation(miscDemographics_Id,miscDemographics_MasterId,miscDemographics_CreatedDate) SELECT i.miscDemographics_ID,i.miscDemographics_MasterId,GETDATE() FROM inserted i –END WHERE NOT EXISTS (SELECT * FROM dbo.miscDemographics_Relation mrl WHERE i.miscDemographics_ID=mrl.miscDemographics_ID AND ISNULL(i.miscDemographics_MasterId,0)=ISNULL(mrl.miscDemographics_MasterId,0))
-
How to create dynamic json for jplayer dynamic media file type
var jsonmedia = {}; jsonmedia[mediatype] = mediafile; jsonmedia[“poster”] = “/pccas/Uploads/AttachedDoc/Big_Buck_Bunny_Trailer_480x270.png”; $(“#jquery_jplayer_1”).jPlayer({ ready: function () { $(this).jPlayer(“setMedia”, jsonmedia ); }, swfPath: “/js”, supplied: “m4v, ogv,m4a,mp3,mp4”, size: { width: “640px”, height:…
-
split and compare date in sql server
ALTER FUNCTION fn_Select_Age_Range ( @dob datetime ) RETURNS nvarchar(200) AS BEGIN declare @year int declare @month int declare @Days int declare @AgeRange nvarchar(200) SELECT @year=Years, @month=Months,@Days=[Days] FROM dbo.fnDateDifference(@dob,GETDATE()) select…
-
Convert date from dd/mm/yyyy and get last date of month
For selecting converting var char to date. and replace with last date of the month of the date DECLARE @vdt nvarchar(MAX)=’2/2014′ –select CONVERT(date,’1/’+@vdt,103) select CAST(dateadd(month,1+datediff(month,0, CONVERT(date,’1/’+@vdt,103) ),-1) as DATE)