SQL Joins

Image
Joins are used to combine rows from two or more tables based on related columns between them. Joins allow you to retrieve data from multiple tables simultaneously, enabling you to create complex queries that fetch data from different sources. There are different types of joins in SQL, including: INNER JOIN Returns only the rows that have matching values in both tables based on the specified join condition. It discards non-matching rows from both tables. Example:           create table t1(x int); insert into t1 values(1); insert into t1 values(1); insert into t1 values(0); create table t2(y int); insert into t2 values(0); insert into t2 values(1); insert into t2 values(1);           select * from t1 inner join t2 on t1.x = t2.y Output: 2. LEFT JOIN (or) LEFT OUTER JOIN Returns all the rows from the left (or first) table and the matching rows from the right (or second) table. If there is no match, NULL values are

SQL Access WebApi with Basic Authentication

exec CALLWEBSERVICE 'username','password'


CREATE PROCEDURE CALLWEBSERVICE(@Username NVARCHAR(50), @Password NVARCHAR(50))
AS
    BEGIN
    Declare @Object as Int;
    DECLARE @authHeader VARCHAR(8000);   
    DECLARE @contentType VARCHAR(8000);
    DECLARE @postData NVARCHAR(4000);
    Declare @json as table(response nvarchar(max))

    SET @postData = '{"method":"GetUserVehicles","userid":"1323","companyid":"0"}';   
    SET @contentType = 'application/json';
    SET @authHeader = @Username + ':' + @Password;
   
    SELECT
        @authHeader = 'BASIC ' + CAST(N'' AS XML).value(
              'xs:base64Binary(xs:hexBinary(sql:column("bin")))'
            , 'VARCHAR(MAX)'
        )  
    FROM (
    SELECT
        CAST(@authHeader AS VARBINARY(MAX)) AS bin 
    ) AS bin_sql_server_temp;

    EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
    EXEC sp_OAMethod @Object, 'open', NULL, 'POST', 'http://yourdomain.com/api','false'
    EXEC sp_OAMethod @Object, 'setRequestHeader', NULL, 'Authorization', @authHeader;
    EXEC sp_OAMethod @Object, 'setRequestHeader', NULL, 'Content-type', @contentType;
    Exec sp_OAMethod @Object, 'send' , NULL, @postData
    Exec sp_OAMethod @Object, 'responseText', @json OUTPUT

    INSERT INTO @json (response) EXEC sp_OAGetProperty @Object, 'responseText'
    SELECT  * FROM @json
    EXEC sp_OADestroy @Object
END

Comments

  1. Sql Access Webapi With Basic Authentication >>>>> Download Now

    >>>>> Download Full

    Sql Access Webapi With Basic Authentication >>>>> Download LINK

    >>>>> Download Now

    Sql Access Webapi With Basic Authentication >>>>> Download Full

    >>>>> Download LINK E4

    ReplyDelete

Post a Comment

Popular posts from this blog

Machine Learning Foundations - Deep Learning Summary - Quiz

Machine Learning Foundations - Recommender System - Quiz

Machine Learning Foundation - Deep Learning - Programming Assignment