Hi,
I want to insert some values to the database based on a where condition.Could someone help me on this.I am using sqlsrv drivers.
Thanks in advance
Faiz
Inserting into SQL SERVER with a where condition
Moderator: General Moderators
Re: Inserting into SQL SERVER with a where condition
You're wrong about something: either it isn't inserting or there is no "condition" to be applied. Even if you say you're right, there is still no such thing as "inserting" with "a where condition".
What are you trying to do?
What are you trying to do?
Re: Inserting into SQL SERVER with a where condition
i want to execute the following code in php
insert in <tablename> (<fieldnames>) Values(<values...> ) where employeeno = 1;
this query is possible in sql server.The query has no error.But I want to know how to do it when i am running a php page.Like i want to insert the details of an employee whose employee no is 1.
insert in <tablename> (<fieldnames>) Values(<values...> ) where employeeno = 1;
this query is possible in sql server.The query has no error.But I want to know how to do it when i am running a php page.Like i want to insert the details of an employee whose employee no is 1.
Re: Inserting into SQL SERVER with a where condition
Possible? I'm looking at the T-SQL INSERT syntax and I don't see how.
What you're trying to do is
Look at the sqlsrv documentation to see how to execute a query.
What you're trying to do is
Code: Select all
insert in <tablename> (employeeno, <fieldnames>) Values(1, <values...> );Re: Inserting into SQL SERVER with a where condition
Oh sorry.I think i have to use update command for it....