Hi Guys,
I have the following scrip :
sqlps -NoLogo -Command{invoke-sqlcmd -InputFile "D:\MyProject\CreateDatabase.sql"}
Which work well, but when when i want to replace the imput file by a variable like that :
[string] $ScriptFilePath="D:\MyProject\CreateDatabase.sql"
sqlps -NoLogo -Command{invoke-sqlcmd -InputFile $ScriptFilePath }
I have the following error : Invoke-Sqlcmd : Cannot validate argument on parameter 'Database'. The argument is null or empty. Supply an argument tha t is not null or empty and then try the command again.
It's crazy, where is the problem?
Sincerly yours