| Greg's profileGreg Olsen - Yellow Duck...PhotosBlogLists | Help |
|
|
January 06 Find a Column Name within your SQL TablesBelow is a piece of T-SQL script which can help you find a column name within your user tables in SQL Server. Tested with SQL Server 2005.
SELECT tab.name AS TableName, col.name AS ColumnName FROM dbo.sysobjects tab INNER JOIN dbo.syscolumns col ON tab.id = col.id WHERE tab.xtype = 'U' -- User Table AND col.name LIKE '%geek%' -- Column Name you're looking for. ORDER BY tab.name Enjoy! Greg Olsen Yellow Duck Guy August 10 SQL Server 2008 - RTM Now Available!Refresh All Views in Database with T-SQLThis is a handy little piece of code I wrote, which can help if you ever need to refresh your database views within SQL Server. I have tested this on SQL Server 2005 recently. I have also had a SQL Job run this stored procedure to update my views more frequently. I had used this to keep views up-to-date for database integration projects. 1: CREATE Procedure dbo.RefreshAllViews 2: AS 3: 4: DECLARE @ViewName nvarchar(max) 5: DECLARE @SQL nvarchar(max) 6: 7: DECLARE extensionViews CURSOR FOR 8: -- Get all views within the database 9: SELECT [name] As ViewName 10: FROM sys.views 11: 12: OPEN extensionViews 13: 14: FETCH NEXT FROM extensionViews 15: INTO @ViewName 16: 17: -- Check @@FETCH_STATUS to see if there are any more rows to fetch. 18: WHILE @@FETCH_STATUS = 0 19: BEGIN 20: 21: -- Build the dynamic SQL for updating the view on the fetched row 22: SET @SQL = 23: 'IF EXISTS (SELECT * FROM sysobjects WHERE type = ''V'' AND name = ''' + @ViewName +''') 24: BEGIN25: exec sp_refreshview N''dbo.'+ @ViewName + '''END' 26: 27: exec(@SQL) 28: 29: -- This is executed as long as the previous fetch succeeds. 30: FETCH NEXT FROM extensionViews 31: INTO @ViewName 32: END 33: 34: CLOSE extensionViews 35: DEALLOCATE extensionViews 36: 37: GOHope you find a use for this! November 04 SQL Reporting Services - Easy Date FunctionSometimes I use this simple but effective date function in my reports (NZ reports) by using the 'Code' functionality given by SQL Reporting Services. Therefore I thought I would paste this on my site for quick reference. Feel free to use. Public Function FormatDate(ByVal d As Date) To find where to paste your code then simply goto 'Report Properties' from the Report Menu (in Report Designer) and select the 'Code' tab. Then paste your code inside the window made available and click OK. Then to use in your reports, simply call it like the following ... =code.FormatDate(Fields!DATE.Value) The function above also illustrates how you can write your own functions and call them within your report. If you are ever wondering where your code will be stored then have a look inside your RDL (report exension .rdl) report file and search for the XML tags of <CODE></CODE>. You will notice it inside there.
August 08 Options for Creating SSRS ReportsThere are 2 options for creating Microsoft SQL Server Reporting Services Reports:
Report Builder Microsoft hasn't forgotten the end user i.e. your Business Analyst. SQL Server is shipping with an end-user reporting tool right in the box. Report Builder is a ClickOnce Windows Forms application that users download from the report server to their local computer. That means that end users install it from the Web browser, but once installed it's not a browser-based application. To get started with Report Builder, browse to your Reporting Services home page. This will have a URL something like http://YellowDuckGuyServer/Reports (or http://localhost/Reports if you're running the browser (within IIS) on the same box with SQL Server 2005 itself - sometimes common where starting out!). Next you will need to click the Report Builder link in the home page menu bar to install and launch Report Builder. The Report Builder will load with the New Report dialog box, showing all the available report models. I suggest you try this out if you want to get started with the Report Builder. Your DBA will need to do a bit of setup before your end users can create their own reports. Your end users also will need to know about their data also in order to design useful reports. Users create reports within the Report Builder by simply dragging fields from the predefined report models onto a pre-designed report layout template. Users can format, group and sort, and filter their data. In addition, they can edit or define formulas. With Report Builder, users don't need to understand the underlying structure of the data source and they don't need to understand any complex computing languages. They simply need to be familiar with the data in their data sources. Report Designer Report Designer is the tool I use the most when designing reports and is focused towards your developers. You can use Report Designer within Visual Studio after installing Reporting Services on your machine or simply the Report Designer. I'm currently using SQL Reporting Services 2005 with Visual Studio 2005. So your developers (that includes me!) will use Report Designer to create more complex reports. You have complete control over the layout, and you can add advanced features such as expressions, custom assemblies that run from the report, and report interaction for drilling down or linking to related data. You can also create basic reports that consist of simple tables, matrix, image, or lists. In Report Designer, you can create a report in three ways.
Reports are published to a report server as Report Definition Language (RDL). files as I slightly mentioned in my previous SSRS Yellow Duck Guy posting. Because a report definition is an XML document, you can create and edit reports using anything you like that can attack an XML file i.e. XML Notepad. Under the hood, Report Designer uses the Reporting Services Simple Object Access Protocol (SOAP) API to publish reports to a report server. You also have the option to upload reports using Report Manager on the report server (this could also be on your local machine). Well now you should know the options available for building reports with SQL Server Reporting Services (SSRS). Yellow Duck Guy SQL Server 2005 Reporting Services (SSRS) - IntroMicrosoft SQL Server 2005 Reporting Services (SSRS) will provide you very rich enterprise reporting capabilities and Web-enabled reporting functionality. You create reports which can report off a number of different data sources (I prefer SQL Server) normally via Reporting Services "DataSet" Report Designer object. SQL Reporting Services add-in Report Designer for Visual Studio allows to you automatically deploy your reports within Visual Studio to a centalised report server. The central report server will also manage security and subscriptions (think of these as scheduled tasks) for your report(s). The report server also allows you to upload the report (file extension of .rdl) file via the built in Report Manager. SSRS reports can be published in different formats i.e. PDF, Excel, CSV, HTM just to name a few.
Below is an overview of where SSRS sits within the breakdown of SQL Server product from Microsoft.
More Reporting Services Information to be delivered on Yellow Duck Guy - so keep checking back for more!
Yellow Duck Guy July 09 List all your databases on your server with T-SQLWell if you would like to list all the databases on your Microsoft SQL Server then you can simply use this T-SQL piece of code below (tested with Microsoft SQL Server 2005): PRINT 'List of all databases within your server:' Enjoy! Yellow Duck Guy June 18 SQL Script to GRANT EXECUTE Permissions to all Stored ProceduresWell I had a task on one of my projects to GRANT EXECUTE rights to all stored procedures to a certain database role I had set up and I wanted this to be scripted. So I thought we must be able to build up some nice SQL script using the select command ..... and you can!
Below is an example script you can past into SQL Management Studio (SQL Server 2005) or Query Analyser (SQL Server 2000) which will build the T-SQL required for scripting. You will need to change the text YellowDuckGuyRole to your role you have created (create a role if you don't have one). Type 'P' stands for Stored Procedures from sys.objects.
select 'GRANT EXECUTE ON dbo.' + name + ' TO YellowDuckGuyRole'
from sys.objects where type = 'P' order by name Once you have the output in SQL Server then you can save the results as you like i.e. to text file or simply copy the results and paste into notepad - easy!
Yellow Duck Guy
Greg Olsen Microsoft Acquires Dundas for SQL Server 2008Well I just found this article on the web and thought - great! Dundas has been an awesome data reporting tool for years and now Microsoft has acquired Dundas's data visualization technology and now "will be part of the final feature set for Microsoft SQL Server 2008 Reporting Services."
More about the acquisition can be found here:
Yellow Duck Guy
Greg Olsen June 11 SQL Server 2008 - 'Katmai' June CTP is now availableHad news today that SQL Server 2008 code name 'Katmai' June CTP is available for download.
@@version from 9.0 to 10.0 !! - now thats geeky .. right?
If you want to get a hold of this for an early look, then head over to:
This link will provide you with guidance information.
BUT YOU WANT THE DOWNLOAD RIGHT?
1. Then do head to here for sign up with the CTP Program (do this first)
2. Download your required version:
One new feature: There are new data types, DATE & TIME Tell us any cool things you find!! Yellow Duck Guy |
|
|