IF statement in SQL?
- From: "bakedmike via SQLMonster.com" <u15016@uwe>
- Date: Tue, 08 Nov 2005 15:21:07 GMT
Can I write an if statement in T-SQL for MSSQL2K or do I have to do it in the
WHERE clause?
Would like to say:
IF field1 = e
insert into db2.accounts from db1.accounts where in db2.employee
IF field2 = c
insert into db2.accounts from db1.accounts where in db2.company
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-mseq/200511/1
.
Relevant Pages
- Re: IF statement in SQL?
... > Can I write an if statement in T-SQL for MSSQL2K or do I have to do it in ... In what table does "field1" exist? ... Most likely you should be using a WHERE clause, ... SQL Server MVP ... (microsoft.public.sqlserver.mseq) - Re: Unusual Sorting Requirement
... PIVOT Field1 & Field2 ... The ONLY columns that will show up are those listed in the IN clause and those in the Group By clause. ... (microsoft.public.access.queries) - Re: Very simple update query running super slow!
... RugMan SET RugMan.test = "GOOD" ... I have NO idea what ImageFile has to do with anything. ... Your WHERE clause ... implies that it's equal to the value of Field1, ... (microsoft.public.access.queries) - Re: Importing text data into Access with record type selection
... if you import it with a query that gets its data direct from the ... you just use a WHERE clause to select the records you want, ... INSERT INTO MyAccessTable (Field1, Field2, Field3) ... (microsoft.public.access.externaldata) - Re: LIKE in embedded if statement?
... Switch the query to SQL View, and adjust the WHERE clause like this: ... Replace "Field1" with the name of your field. ... If you are interested in building your own search form using code to avoid these convoluted clauses, ... Search form - Handle many optional criteria ... (microsoft.public.access.queries) |
|