|
![](/images/resource/spacer.gif) |
|
อยากทราบ code php ที่เอาคำสั่ง sql ที่เขียนอยุ่ในไฟล์.sql ไปทำการ insert ลง Database MS SQL SERVER 2012 |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
รบกวนสอบถามหน่อยค่ะ พอดีทำหน้า Upload File อ่ะคะ เมื่อทำการ insert ข้อมูลลงฐานข้อมูลเรียบร้อยแล้ว
อยากให้เอาคำสั่ง sql ที่อยู่ในไฟล์ .sql ไปทำการ insert ต่ออ่ะคะ ไม่ทราบต้องเขียนยังไงค่ะ หรือพอมีตัวอย่างให้ดูไหมค่ะ
ตัวอย่าง script ที่อยู่ในไฟล์ .Sql (แต่จริงๆจะมีมากว่านี้)
Code (SQL)
delete from [TEST1].[FACT].[All]
insert into [TEST1].[FACT].[All]
(
[RunningNo]
,[bank]
,[NO]
,[datetime]
,[CUSTOMERNAME]
,[Telephone]
,[ID_CARD]
,[Description]
,[AMOUNT]
,[date_received]
,[ReferenceNo]
)
SELECT [RunningNo]
,'BBL'
,[No]
,[DateTime]
,[name]
,[Telephone]
,[ID]
,[Branch]
,[Amount]
,[Doc_Date]
,[Doc_No]
FROM [TEST2].[DIY].[BBL]
Tag : PHP, Ms SQL Server 2012
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-11-18 18:04:19 |
By :
kungjung |
View :
742 |
Reply :
1 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Code (PHP)
$strSQL = "
delete from [TEST1].[FACT].[All]
insert into [TEST1].[FACT].[All]
(
[RunningNo]
,[bank]
,[NO]
,[datetime]
,[CUSTOMERNAME]
,[Telephone]
,[ID_CARD]
,[Description]
,[AMOUNT]
,[date_received]
,[ReferenceNo]
)
SELECT [RunningNo]
,'BBL'
,[No]
,[DateTime]
,[name]
,[Telephone]
,[ID]
,[Branch]
,[Amount]
,[Doc_Date]
,[Doc_No]
FROM [TEST2].[DIY].[BBL]
";
เอา $strSQL ไป Query ได้เลยครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-11-21 12:16:12 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 04
|