Files

13 lines
509 B
PowerShell
Executable File

Add-Type -AssemblyName System.Data
$conn = New-Object System.Data.SqlClient.SqlConnection('server=10.10.10.101;database=GXWMS;uid=sa;pwd=Gx@20240111')
$conn.Open()
$cmd = $conn.CreateCommand()
$cmd.CommandText = Get-Content 'd:\Code\WMS\WebApi\docs\create_production_delivery.sql' -Raw
$cmd.ExecuteNonQuery() | Out-Null
# 验证表存在
$cmd.CommandText = "SELECT COUNT(*) FROM sys.tables WHERE name='Production_Delivery'"
$n = $cmd.ExecuteScalar()
$conn.Close()
Write-Output "Table exists: $n"