einspieln von sql scripts:
-h host
--username=...
-f file
-d datenbank
psql -h localhost --username=s2010_admin -f c:\sql\test.sql -d s2010
autoincrement=bigserial (=8byte integer), zusätzlich primary key angeben !
create table Einnahmeform ( javascript:void(0)
ID BIGSERIAL CONSTRAINT PK PRIMARY KEY,
Einnahmeform varchar(80)
);
alle tabellen in einem schema
SELECT table_name FROM information_schema.tables where table_schema='schemaname'
meine Sys/Db admin & Developper Notitzen - wer Rechtschreibfehler findet darf sie behalten ... my Sys/Db Admin and developper notes - I don't care about typos
Showing posts with label datenbanken. Show all posts
Showing posts with label datenbanken. Show all posts
Tuesday, November 16, 2010
Friday, January 08, 2010
SQLServerCompact
SQLServerCompact speichert Datenbanken in sdf Dateien. Unter Win7 64bit erhielt ich den Fehler "unable to oad DLL sqlceme35.dll" , ausserdem wird beim kopieren einer sdf Datei eine neue Datenbank angelegt, anstatt den Inhalt mitzukopieren. Die SDF Dateein können übers SqlManagement Studio (Connect SqlServer Compact) oder das Visual Studio gewartet werden. Schema und Daten einer SQL Server Datenbank am besten mt Merge Replikation übertragen, eine SQLCompactDatei als Linked Server einzubinden ist mir nicht gelungen, umgekehrt gibt es diesen Punkt nicht. Mit VS2008 kann man die Daten editieren.
Zugriff auf eine sdf Datei aus c#:
SqlCeConnection con = new SqlCeConnection("Data Source=|DataDirectory|\\TodoList.sdf");
con.Open();
SqlCeCommand com = new SqlCeCommand("Select count(*) from Tasks", con);
object o =com.ExecuteScalar();
SqlCeDataAdapter da = new SqlCeDataAdapter("Select * from Tasks", con);
DataTable dt = new DataTable();
da.Fill(dt);
oder reinziehen der Tabellen aus dem Server Explorer in ein typisiertes Dataset (xsd), dann werden auch gleich die entsprechenden Table Adapter erstellt.
Zugriff auf eine sdf Datei aus c#:
SqlCeConnection con = new SqlCeConnection("Data Source=|DataDirectory|\\TodoList.sdf");
con.Open();
SqlCeCommand com = new SqlCeCommand("Select count(*) from Tasks", con);
object o =com.ExecuteScalar();
SqlCeDataAdapter da = new SqlCeDataAdapter("Select * from Tasks", con);
DataTable dt = new DataTable();
da.Fill(dt);
oder reinziehen der Tabellen aus dem Server Explorer in ein typisiertes Dataset (xsd), dann werden auch gleich die entsprechenden Table Adapter erstellt.
Sunday, December 06, 2009
Database Mail auf sql2008 konfigurieren
sp_configure 'Database Mail XPs', 1; lieferte die Fehlermeldung, dass die Option 'Database Mail XPs' nicht verfügbar ist - advanced options müssen auch eingestellt werden:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO
nützliche Stored Procedures und Views:
exec msdb.dbo.sp_send_dbmail @profile_name='dbmp',@recipients='x@y.z',@body='test body',@subject='test header'
exec msdb.dbo.sysmail_start_sp
exec msdb.dbo.sp_SendMailQueues 'test'
SELECT * FROM [msdb].[dbo].[sysmail_log]
SELECT * FROM msdb.dbo.sysmail_allitems -- This view allows you to return a record set that contains one row for each email message processed by Database mail.
SELECT * FROM msdb.dbo.sysmail_event_log -- This view returns a row for each Windows or SQL Server error message returned when Database Mail tries to process an email message.
SELECT * FROM msdb.dbo.sysmail_faileditems -- This view returns one record for each email message that has a status of failed.
SELECT * FROM msdb.dbo.sysmail_mailattachments --This view contains one row for each attachment sent
SELECT * FROM msdb.dbo.sysmail_sentitems -- This view contains one record for every successfully email sent
SELECT * FROM msdb.dbo.sysmail_unsentitems –
weitere Infos
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO
nützliche Stored Procedures und Views:
exec msdb.dbo.sp_send_dbmail @profile_name='dbmp',@recipients='x@y.z',@body='test body',@subject='test header'
exec msdb.dbo.sysmail_start_sp
exec msdb.dbo.sp_SendMailQueues 'test'
SELECT * FROM [msdb].[dbo].[sysmail_log]
SELECT * FROM msdb.dbo.sysmail_allitems -- This view allows you to return a record set that contains one row for each email message processed by Database mail.
SELECT * FROM msdb.dbo.sysmail_event_log -- This view returns a row for each Windows or SQL Server error message returned when Database Mail tries to process an email message.
SELECT * FROM msdb.dbo.sysmail_faileditems -- This view returns one record for each email message that has a status of failed.
SELECT * FROM msdb.dbo.sysmail_mailattachments --This view contains one row for each attachment sent
SELECT * FROM msdb.dbo.sysmail_sentitems -- This view contains one record for every successfully email sent
SELECT * FROM msdb.dbo.sysmail_unsentitems –
weitere Infos
Subscribe to:
Posts (Atom)