SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE '%whatev%' ORDER BY ROUTINE_NAME
Tag Archive for sql
Search stored procedures for string
TSQL Function and Check Constraint to Ensure that a Parent Value is Present in the Table
ALTER TABLE [dbo].[Message] WITH CHECK ADD CONSTRAINT [CK_Message] CHECK (([InReplyToId] IS NULL OR [dbo].[CheckInReplyToMessageId]([InReplyToId])>=(0))) GO ALTER TABLE [dbo].[Message] CHECK CONSTRAINT [CK_Message] CREATE FUNCTION [dbo].[CheckInReplyToMessageId] ( @MessageId BigInt ) RETURNS bit AS BEGIN DECLARE @RetVal bit SET @RetVal = (SELECT MessageId FROM Message WHERE MessageId = @MessageId) RETURN isnull(@RetVal, 0) END
Change owner on sql server db.
Change owner on sql server db. Restore database from .bak file create login give dbo role. Run the script: use db go SELECT ‘EXEC(â€sp_changeobjectowner @objname = â€â€â€™+ ltrim(u.name) + ‘.’ + ltrim(s.name) + â€â€â€ + ‘, @newowner = NEWOWNERâ€)’ FROM sysobjects s, sysusers u WHERE s.uid = u.uid AND u.name ‘NEWOWNER’ AND xtype in (‘V’, ‘P’, ‘U’, ‘FN’) AND u.name not like ‘INFORMATION%’ order by s.name copy paste result to query analyzer go Delete old user exec sp_changedbowner ‘newowner’ Change login name for dbo to newowner (pwd = same) bmssa/bmssa
Drop down option in field for MySQL
Campo ENUM ('-','D','E','L','S') NOT NULL
Ordenar un query por longitud de una cadena
SELECT ... ORDER BY LENGTH(your_field);
Find a constraint by name
SELECT * FROM all_constraints WHERE constraint_name='THE_CONSTRAINT';
TSQL Backup / Restore
BACKUP DATABASE @dbname TO DISK = @filelocation GO RESTORE DATABASE @dbname FROM DISK = @filelocation GO
Program used to compare the SAS datasets in two directories
Here is the new Proc compare.sas program, I have developed ....to compare all the datasets in 2 directories(testing and production) at once and to quick check any mismatches. Proc compare only check if there is any mismatches between the datasets in 2 directories. If any, it reports otherwise it will give us a note saying that: Note: No unequal Values were found. All values compared are exactly equal. contd.....