Badges

Types

Formats

Show Only

SMTP from MSSQL Procedure
https://mreschke.com/167/smtp-from-mssql-procedure
Ability to send an email from a MSSQL Stored Procedure http:www.sqldev.net/xp/xpsmtp.htm Download the attached .zip and extract Copy the xpsmtp80.dll to C:\Program Files\Microsoft SQL Server\MSSQL\Binn Run this procedure on the servers master database _ exec sp_addextendedproc 'xp_smtp_sendmail', 'xpsmtp80.dll' Use this syntax for a simple email _ DECLARE @rc INT EXEC @rc = master.dbo.xp_smtp_sendmail @FROM = N'from@email.com', @FROM_NAME = N'fromname', @replyto = N'replyto@email.com', @TO = N'...
|
post #167 by mreschke Dec 23rd 2009 (6767 views)
Repair Corrupt InnoDB Tables
https://mreschke.com/148/repair-corrupt-innodb-tables
Repair a MySQL InnoDB database table corrupted by a power outage = :related: Related Topics :r: I have a linux server built from a standard dell workstation. 1 500g sata II drive, core 2 duo, 1g ram. It is running Ubuntu server 8.04 with mysql (InnoDB tables), php, apache, and Zabbix. The primary role of this server is to monitor our other production servers using an open source monitoring application called Zabbix. We had a large electrical/tornado storm one day and power went out to the zabbi...
|
post #148 by mreschke Jun 18th 2009 (11997 views)
Concat Rows in MSSQL
https://mreschke.com/138/concat-rows-in-mssql
How to return a comma separated list, in one column, from a field in multiple rows. If you have, for example, email addresses on multiple rows in a table but want to return them as one column, comma separated. Example: Database table ID | report_id | email | 1 | 1 | email1@email.com 2 | 1 | email2@email.com 3 | 1 | email3@email.com I want a return of report_id | email -| 1 | email1@emailcom,email2@email.com,email3@email.com To achieve this, you must create a user defined function which will conc...
|
post #138 by mreschke Mar 3rd 2009 (4070 views)
MySQL Performance & Optimization
https://mreschke.com/108/mysql-performance-optimization
InnoDB provides MySQL with a transaction-safe (ACID compliant) storage engine that has commit, rollback, and crash recovery capabilities. However, it cannot do so if the underlying operating system or hardware does not work as advertised. Many operating systems or disk subsystems may delay or reorder write operations to improve performance. On some operating systems, the very system call that should wait until all unwritten data for a file has been flushed - fsync() - might actually return befo...
|
post #108 by mreschke Sep 23rd 2008 (6220 views)
MSSQL Maintenance
https://mreschke.com/92/mssql-maintenance
SQL Server 2000 Maintenance > The database administrator works like a doctor, keeping databases healthy. Learn the routine maintenance tasks that can help your databases live a long and active life. SQL Server 2000 eliminates the need to run DBCC CHECKDB or DBCC CHECKALLOC. 99% of database failures and corruption with SQL Server 2000 happen due to hardware failures. It is still a good Idea to run DBCC CHECKDB to ensure the overall health of your database prior to backing it up. DBCC C...
|
post #92 by mreschke Jul 23rd 2008 (8826 views)
MSSQL Natural Sort Workaround
https://mreschke.com/76/mssql-natural-sort-workaround
If you have a column that contains some alpha and some numeric data, SQL sees the entire column as alpha and sorts the data differently. Here is an example of an alpha column order by: 105k 10k 120k 20k Another Field Yet Another Field This is obvious since 5 (in 105k) is less than k (in 10k). This is the logical, correct way to sort alpha-numeric data. But I want the order to be 10k, 20k, 105k... In SQL, the column type is defined by the table you are pulling the data from, so if the table colu...
|
post #76 by mreschke Jun 11th 2008 (4611 views)
SQL Divide by Zero Fix
https://mreschke.com/72/sql-divide-by-zero-fix
<p>There are three ways to avoid the "Division by zero encountered" error in your SELECT statement and these are as follows:</p> <ul> <li>CASE statement</li> <li>NULLIF/ISNULL functions</li> <li>SET ARITHABORT OFF and SET ANSI_WARNINGS OFF</li> </ul>
|
post #72 by mreschke May 30th 2008 (9161 views)
MSSQL Date Functions
https://mreschke.com/48/mssql-date-functions
Date and time function tutorials and examples in MSSQL This topic contains a few of the MSSQL date functions and some useful snippets. Dates can get a little confusing in SQL but a good knowledge of their functions is critical for most data queries. Since the date manipulation queries are quite large, its best to set a @variable and reference that variable throughout the code. Remember that the SQL data type has hours, minutes, seconds and sometimes milliseconds also, so you must account for th...
|
post #48 by mreschke Apr 30th 2008 (26511 views)
MSSQL Shared Servers
https://mreschke.com/27/mssql-shared-servers
<ol> <li>Goto Administration Tools -> Component Services<ol> <li>Under Services (local), start the 'Distributed Transaction Coordinator'</li> <li>Goto properties on 'Distributed Transaction Coordinator', Log On tab, make sure account is NetworkServices</li> </ol></li> <li>Under Component Services, expand to My Computer, goto properties on My Computer<ol> <li>MSDTC tab, then click Security Configuration</li> <li>Check 'Network DTC Access'</li> <li>Check 'Allow Remote Administration'</li> <li>Check 'Allow Inbound'</li> <li>Check 'Allow Outbound'</li> <li>Check 'No Authentication Required'</li> <li>Check 'Enable Transaction Internet Protocol (TIP) Transactions'</li> <li>Check 'Enable XA TRansactions'</li> <li>The Acount should be NetworkServices here also</li> </ol></li> <li>Open MSSQL Enterprise Manager, expand to localhost<ol> <li>Open Security</li> <li>Right Click Linked Servers, click New Linked Server...</li> <li>Enter each servers information, on each server</li> </ol></li> </ol>
|
post #27 by mreschke Feb 18th 2008 (2836 views)
SQL Temporary Tables
https://mreschke.com/20/sql-temporary-tables
CREATE TABLE #month0to6 (vin nvarchar(20)) DECLARE @startDate as nvarchar(10), SCF as nvarchar SET @startDate = '10/31/2007' --Insert 0 to 6 month data INSERT INTO #month0to6 (vin) SELECT DISTINCT tblVehicles.VEH_vin FROM tblROTotal --INNER JOIN tblApplications ON tblROTotal.ROH_DLR_APP_ID = tblApplications.APP_ID INNER JOIN tblVehicles ON tblROTotal.ROH_VEH_ID = tblVehicles.VEH_ID INNER JOIN tblMakeModel ON tblVehicles.VEH_MM_ID = tblMakeModel.MM_ID INNER JOIN tblCustomer ON tblCustomer.Cust_I...
|
post #20 by mreschke Jan 25th 2008 (2309 views)
SQL Cursor Examples
https://mreschke.com/6/sql-cursor-examples
DECLARE @server as nvarchar(50), @sql as nvarchar(4000) DECLARE SharedServers CURSOR FORWARD_ONLY FOR SELECT server FROM .ebis_prod.dbo.SharedServerList OPEN SharedServers FETCH NEXT FROM SharedServers INTO @server BEGIN TRANSACTION SET @sql = '' WHILE FETCH_STATUS = 0 BEGIN IF (@server) '' BEGIN --One itteration of SQL goes HERE SET @sql = @sql INSERT INTO .dyna.dbo.TestTable (val1, val2) VALUES (''mReschke'', ''hi'') ' END FETCH NEXT FROM SharedServers INTO @server END exec sp_executesql @sql...
|
post #6 by mreschke Nov 13th 2007 (2740 views)
Showing 1 to 11 of 11 results