• jsimpson (3/12/2009)


    Great stuff. I have no problems at all with get-sqldata, but I cant get set-sqldata to work...

    Ok, so this works

    Get-SqlData 'VISTA-LAPPY\SQLEXPRESS' Worldship 'SELECT top 3 * FROM

    dbo.UPSData'

    But this does not...

    Get-SqlData 'VISTA-LAPPY\SQLEXPRESS' Worldship 'INSERT INTO dbo.UPSpod

    (Sheet, User) VALUES (4, Jim)'

    Nether does:

    Set-SqlData 'VISTA-LAPPY\SQLEXPRESS' Worldship "INSERT INTO dbo.UPSpod

    (Sheet, User) VALUES (4, 'Jim')"

    The insert statement works in SQL, so I am not sure what i am

    missing.... Hope you can help.

    Thanks. I'm suprised the insert statement works in SQL for you. The column name "user" gives me an error message of "Incorrect syntax near the keyword 'user'". In both SQL Server Management Studio and Powershell I have to enclose the SQL reserved keyword "user" in brackets i.e. and only then does the insert work.

    Set-SqlData 'Z002\SQL2K8' dbautility "INSERT INTO dbo.UPSpod (Sheet, [User]) VALUES (4, 'Jim')"