Tuesday, January 22, 2013

Split function in sql server


I have created a function for spliting the string of any type with the required delimeter which you want to specify hope so this function will solve your splitting problem in sql server.

CREATE FUNCTION dbo.fnSplit(
    @sInputList VARCHAR(8000) -- List of delimited items
  , @sDelimiter VARCHAR(8000) = ',' -- delimiter that separates items
) RETURNS @List TABLE (item VARCHAR(8000))

BEGIN
DECLARE @sItem VARCHAR(8000)
WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0
 BEGIN
 SELECT
  @sItem=RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1))),
  @sInputList=RTRIM(LTRIM(SUBSTRING(@sInputList,CHARINDEX(@sDelimiter,@sInputList,0)+LEN(@sDelimiter),LEN(@sInputList))))

 IF LEN(@sItem) > 0
  INSERT INTO @List SELECT @sItem
 END

IF LEN(@sInputList) > 0
 INSERT INTO @List SELECT @sInputList -- Put the last item in
RETURN
END
GO

Tuesday, January 8, 2013

Write Div Content on new window


We want to open new window and write content on it which we want to write into it.
$("#adv").click(function () {
            var html = $("#dvcontent").html();
            var w = window.open();
            w.document.writeln(html);
       });

Monday, January 7, 2013

Integrate Google Map into our MVC application


This is the code for integrating google map into our all types application just u paste this code and pass the longitude and latitude into function it ll automtically take the location and show ur desired place to u and you can manage it urself as u want.enjoy.....
script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAVc
JQrx7VsumiP2heFwp
6URQLaiSrhXTkLq3m
A9rOmHpVsHwBjxT
g7C5-XXHl634dCROpHwK
MO9BzmQ&sensor=true_or_false"
            type="text/javascript" script




    script type="text/javascript"

        function initialize() {
            if (GBrowserIsCompatible()) {
                var map = new GMap2(document.getElementById("map_canvas"));
                map.setCenter(new GLatLng(20.593684, 78.96288), 13);
                map.setUIToDefault();
            }
        }

   script

  body onload="initialize()" onunload="GUnload()"
    div id="map_canvas" style="width: 500px; height: 300px">
  body