Assuming a simple table: CREATE TABLE dbo.foo(ID INT IDENTITY(1,1), name SYSNAME); We can capture IDENTITY values in a table variable for further consumption. DECLARE @IDs TABLE(ID INT); — minor change to INSERT statement; add an OUTPUT clause: INSERT dbo.foo(name) OUTPUT inserted.ID INTO @IDs(ID) SELECT N’Fred’ UNION ALL SELECT N’Bob’; SELECT ID FROM @IDs; The nice … Continue reading
1. Getting All Table in database : USE your_database SELECT name FROM sys.tables 2. Getting All Field in database, if you want getting all field with description can use this : SELECT u.name + ‘.’ + t.name AS [table], td.value AS [table_desc], c.name AS [column], cd.value AS [column_desc] FROM sysobjects t INNER JOIN sysusers u … Continue reading
WINDOWS XP & 2003 SERVER a. Run cmd.. type “inetmgr” b. Disable Anonymous Access in Reports&ReportServer Virtual Directory c. Goto IE Browser, and type http://localhost/reports > Properties Tab > Security d. Add new Role Assigment for NT AUTHORITY\IUSR or IUSR_<COMPUTERNAME> e. Enable Anonymous Access in Reports&ReportServer Virtual Directory f. Restart SQLSERVER service. WINDOWS 7 & 2008 SERVER a. … Continue reading
Datetime functions allow manipulating columns with DATETIME/SMALLDATETIME data types. SQL server DateTime Function: GETDATE and GETUTCDATE Functions GETDATE and GETUTCDATE Functions are Nondeterministic function. Both functions returns the current date and time. GETDATE returns current system date and time of the computer where SQL Server is running. GETUTCDATE returns current UTC time (Universal Time Coordinate … Continue reading
A reader sent me a question recently in which he wanted toknow how to display currency amounts in the format we commonly refer to ascurrency. (I realize how geo-centric this is, so I will attempt to beworld-centric in my response to the reader’s question.) Let’s use the Northwind databaseas our testbed. Consider the following SQL … Continue reading