sql >> データベース >  >> RDS >> Sqlserver

クエリリンクサーバーにIPを入力する方法

    リモートストアドプロシージャは、次の4つの部分の名前で呼び出すことができます。

    EXEC [RemoteServer] .DatabaseName.DatabaseOwner.StoredProcedureName
    

    なぜ動的SQLを使用しているのかわかりません。このようにしてみてください。

    DECLARE @ScopeIdentity INT;
    
    INSERT INTO [175.110.104.162].Taxi.dbo.booking (
        FromLocTypeId
        ,ToLocTypeId
        ,FromLocId
        ,ToLocId
        ,VehicleTypeId
        ,DriverId
        ,ReturnDriverId
        ,CustomerId
        ,CustomerName
        ,CustomerEmail
        ,CustomerPhoneNo
        ,CustomerMobileNo
        ,JourneyTypeId
        ,BookingNo
        ,BookingDate
        ,NoofPassengers
        ,NoofLuggages
        ,NoofHandLuggages
        ,PickupDateTime
        ,ReturnPickupDateTime
        ,IsCompanyWise
        ,CompanyId
        ,FareRate
        ,PaymentTypeId
        ,SpecialRequirements
        ,FromAddress
        ,ToAddress
        ,FromPostCode
        ,ToPostCode
        ,FromDoorNo
        ,ToDoorNo
        ,FromStreet
        ,ToStreet
        ,FromFlightNo
        ,FromComing
        ,BookingStatusId
        ,DistanceString
        ,AutoDespatch
        ,AutoDespatchTime
        ,AddOn
        ,AddBy
        ,AddLog
        ,EditOn
        ,EditBy
        ,EditLog
        ,OrderNo
        ,PupilNo
        ,ParkingCharges
        ,WaitingCharges
        ,ExtraDropCharges
        ,MeetAndGreetCharges
        ,CongtionCharges
        ,TotalCharges
        ,DepartmentId
        ,ReturnFareRate
        ,ArrivalDateTime
        ,MasterJobId
        ,DisablePassengerSMS
        ,DisableDriverSMS
        ,IsCommissionWise
        ,DriverCommission
        ,DespatchDateTime
        ,JobOfferDateTime
        ,BookingTypeId
        ,DriverCommissionType
        ,IsBidding
        ,IsQuotation
        ,CostCenterId
        ,CashRate
        ,AccountRate
        ,WaitingMins
        ,ExtraMile
        ,AcceptedDateTime
        ,POBDateTime
        ,STCDateTime
        ,ClearedDateTime
        ,CancelReason
        ,TotalTravelledMiles
        ,CompanyPrice
        ,SubCompanyId
        ,PartyId
        ,FromOther
        ,ToOther
        ,TransferJobId
        ,TransferJobCommission
        ,BookingTypeId
        ,ViaString
        )
    SELECT FromLocTypeId
        ,ToLocTypeId
        ,FromLocId
        ,ToLocId
        ,VehicleTypeId
        ,NULL
        ,ReturnDriverId
        ,CustomerId
        ,CustomerName
        ,CustomerEmail
        ,CustomerPhoneNo
        ,CustomerMobileNo
        ,JourneyTypeId
        ,BookingNo
        ,BookingDate
        ,NoofPassengers
        ,NoofLuggages
        ,NoofHandLuggages
        ,PickupDateTime
        ,ReturnPickupDateTime
        ,IsCompanyWise
        ,NULL
        ,FareRate
        ,PaymentTypeId
        ,SpecialRequirements
        ,FromAddress
        ,ToAddress
        ,FromPostCode
        ,ToPostCode
        ,FromDoorNo
        ,ToDoorNo
        ,FromStreet
        ,ToStreet
        ,FromFlightNo
        ,FromComing
        ,BookingStatusId
        ,DistanceString
        ,AutoDespatch
        ,AutoDespatchTime
        ,AddOn
        ,AddBy
        ,AddLog
        ,EditOn
        ,EditBy
        ,EditLog
        ,OrderNo
        ,PupilNo
        ,ParkingCharges
        ,WaitingCharges
        ,ExtraDropCharges
        ,MeetAndGreetCharges
        ,CongtionCharges
        ,TotalCharges
        ,DepartmentId
        ,ReturnFareRate
        ,ArrivalDateTime
        ,MasterJobId
        ,DisablePassengerSMS
        ,DisableDriverSMS
        ,IsCommissionWise
        ,DriverCommission
        ,DespatchDateTime
        ,JobOfferDateTime
        ,BookingTypeId
        ,DriverCommissionType
        ,IsBidding
        ,IsQuotation
        ,CostCenterId
        ,CashRate
        ,AccountRate
        ,WaitingMins
        ,ExtraMile
        ,AcceptedDateTime
        ,POBDateTime
        ,STCDateTime
        ,ClearedDateTime
        ,CancelReason
        ,TotalTravelledMiles
        ,CompanyPrice
        ,1
        ,@PartyId
        ,FromOther
        ,ToOther
        ,@JOB_id
        ,@Commission
        ,10
        ,ViaString
    FROM Booking
    WHERE Id = @JOB_id;
    
    SELECT SCOPE_IDENTITY()
    


    1. PostgreSQLで2つの日付間の間隔を見つける方法

    2. 日付範囲 SQL の一連のテストの最も早い順序を選択します

    3. djangoRawQuerySetをQuerysetに変換する

    4. DSNなしの接続を使用してアクセスするパススルークエリを作成するにはどうすればよいですか?