Näytetään tekstit, joissa on tunniste SQL. Näytä kaikki tekstit
Näytetään tekstit, joissa on tunniste SQL. Näytä kaikki tekstit

torstai 3. huhtikuuta 2008

Replace a string in Oracle database field

update myTable a set someField = replace (a.someField,'Ä','A') where someField is not null;
update myTable a set someField = replace (a.someField,'Ö','ö') where someField is not null;
update myTable a set someField = replace (a.someField,'Å','A') where someField is not null;

Oracle Case-When example

select
product,
company,
case when category = 'Microsoft'
then 'Yes!!'
else 'No'
end as microsoft_spotted
from
products
;

List all tables in your Oracle database

select owner, table_name from all_tables;
select * from all_tables;
more on ss64.com

Some Error messages with possible solution in asp-pages

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Solution:
You have mistyped your your database name. Check from tnsnames.ora it exists and is working. Check you can connect to database with SQLPlus.

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
Unspecified error
/website/some.asp, line 13
Solution:
Your database is not running. Start your database. Check you can connect to database with SQLPlus.

keskiviikko 12. syyskuuta 2007

keskiviikko 29. elokuuta 2007

Howto INSERT from MS Access forms

' AutoNumber field is updated automatically if one exists
Private Sub Command1_Click()
Dim SQLI As String
SQLI = "INSERT INTO MYMOVIES ([GENRE],[NAME],[PRODUCTIONYEAR]) " & _

"values ('" & Forms!AddMovie!Genre & "'," & Forms!AddMovie!Name & _
"," & Forms!AddMovie!ProductionYear & "');"
DoCmd.RunSQL SQL_InsertFilm
Response = MsgBox("You added ' " & Forms!AddMovie!FilmName & " '.")
End Sub

maanantai 27. elokuuta 2007

DLookUp

Me.drwno = DLookup("lastdrwno", "tCateg2", "cat2='" & Forms!AddDrawing!ComboCat2 & "'") + 1
is same as :

SELECT
lastdrwno
FROM
tCateg2
WHERE
cat2 = Forms!AddDrawing!ComboCat2 + 1

http://msdn2.microsoft.com/en-us/library/aa172176(office.11).aspx