Categories
SQL Server

Updating multiple table rows using a query

So you made a modification to a table and want to update many rows with values from a different table.

If you want to just insert new rows, you do:

INSERT INTO table1
SELECT val1, val2, val3
FROM table2
WHERE some condition

You need to be sure that the columns used in the insert correspond to the rows of the table you insert into.

Still, if you want to update, the syntax is slightly different:

UPDATE table1
SET col1 = t2.col3,
col2 = t2.col4
FROM table1 t1, table2 t2
WHERE t1.t1_id = t2.t1_id

Now I know…

Share
Categories
Java Web Development

MyEclipse Headache – Removing WebProject Capabilities

After braving the upgrade to Eclipse 3.0 and installing MyEclipse we felt like we enjoyed using it and that it was benficial, especially its very very very cool ability to edit and text-complete JavaScript and HTML.
Still, we are unable to make it work properly with JSTL tags, which it could in previous releases.

So I went ahead and clicked on ‘Add WebProject Capabilities’ to the project from the MyEclipse context menu (right-clicking the project folder). This did not help. Worse, it forced me to have a WEB-INF folder no matter what. I would delete it and it would reappear. Grrrreat.

There is no way to remove WebProject Capabilities either. You gotta love one-way settings. After 20 aggravating minutes, the following surgery did the job:

1. Close Eclipse.
2. Edit the .project file and remove any elements that mention of Genuitec (the company builds MyEclipse).
3. Edit the .classpath file and remove WEB-INF from the classpath.
4. Restart Eclipse and right click the project folder
5. In the ‘Java Build Path’ screen, remove WEB-INF from the Output Folder settings and choose a different destination.
6. Delete the WEB-INF folder.

Phew!

Share
Categories
SQL Server

SQL Server 2000 Error: Cannot generate SSPI context

When trying to connect to SQL Server using Query Analyzer, you might get this perplexing error:

Unable to connect to server localhost: ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Driver] Cannot generate SSPI context

This appears to be a problem with the fact that SQL Server really does not like the name ‘localhost’ too much. Using 127.0.0.1 instead will do the job. Similarly, is using just the server’s name instead of the fully qualified domain name may cause a similar problem.

Share
Share