@echo off
set bkfolder=D:\DATA_LAB\DataLAB\Backup_DB
@echo Backup database is working ....
REM ************* Backup database DB 01***************
set dbname=DATA_ALS
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
sqlcmd -E -S.\SQLEXPRESS -o"%bkfolder%\backup_db_%dbname%_%mydate%_%mytime%.log" -Q"backup database %dbname% to disk='%bkfolder%\%dbname%_%mydate%_%mytime%.bak' "
ขึ้น Error แบบนี้ครับ Code
HResult 0xFFFFFFFF, Level 16, State 1
SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.