DECLARE @ObjectName varchar(100) = '' ,@QUERY varchar(150) = '' WHILE EXISTS (SELECT 1 FROM SYS.OBJECTS WHERE Name > @ObjectName AND TYPE IN ('P', 'U', 'V')) BEGIN SELECT TOP 1 @QUERY = 'GRANT' + CASE WHEN TYPE = 'P' THEN ' EXECUTE ' ELSE ' SELECT ' END + 'On [dbo].['+ NAME +'] TO KABCO' ,@ObjectName = NAME FROM SYS.OBJECTS WHERE Name > @ObjectName AND TYPE IN ('P', 'U', 'V') ORDER BY TYPE, Name PRINT (@QUERY) EXEC (@QUERY) SET @QUERY = '' END
Monthly Archives: August 2011
SELECT o.TYPE_DESC, o.NAME AS OBJECTNAME, dp.PERMISSION_NAME, dp.STATE_DESC, p.NAME FROM SYS.DATABASE_PERMISSIONS AS dp INNER JOIN SYS.OBJECTS AS o ON o.OBJECT_ID = dp.MAJOR_ID INNER JOIN SYS.DATABASE_PRINCIPALS AS p ON p.PRINCIPAL_ID = dp.GRANTEE_PRINCIPAL_ID WHERE dp.CLASS = 1 order by OBJECTNAME
1) FileStream allows you open, writeto, open and close files.
2) StreamWriter let you write to files.
3) StreamReader let you read from files.
4) StreamReader is designed for character input in a particular encoding, whereas the Stream class is designed for byte input and output. Use StreamReader for reading lines ofinformation from a standard text file.
5) StreamWriter is designed for character output in a particular Encoding, whereas classes derived from Stream are designed for byte input and output.
6) A buffer is a block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system. Buffers improve read and write performance. A buffer can be used for either reading or writing, but never both simultaneously. The Read and Write methods of BufferedStream automatically maintain the buffer.BufferedStream can be composed around certain types of streams. It provides implementations for reading and writing bytes to an underlying data source or repository. Use BinaryReaderand BinaryWriter for reading and writing other data types.
7) The MemoryStream class creates streams that have memory as a backing store instead of a disk or a network connection. MemoryStream encapsulates data stored as an unsigned byte array that is initialized upon creation of a MemoryStream object, or the array can be created as empty. The encapsulated data is directly accessible in memory. Memory streams can reduce the need for temporary buffers and files in an application.