//
archives

sql server

This tag is associated with 5 posts

SQL Server Last ID Identity

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

Get All Table,Field and properties in SQL Server

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

Remote Access Reporting Service (Setting Role Reporting Service SQL Server 2005)

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

SQL server Date Time Function

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

Money Format MSSQL SERVER

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

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 10 other subscribers
May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Archives

Web Statistic

Blog Stats

  • 187,136 hits