sql-server

Examples of great looking SSRS pdf reports

Hi, I am trying to make a case of using SSRS as an option for some great looking reports. Is there a place where somebody can point to? I am looking for some great looking fancy data driven reports built using SQL Server SSRS ...

Error handling of stored procedure having known errors being called from vb.net

I have sql server2000 encypted stored procedure. I can not modify them. Typicaly all the procedures manipulate row by row different tables using cursors etc. When the stored procedure is executed at the Query Analyser screen, I see error being thrown in between but the procedures continues till all the records have been processed. This...

What is faster query ...where Fname = 'mark' or ...where Fname like 'mark'

hi What is faster query select...where Fname = 'mark' or select...where Fname like 'mark' thank's ...

sql server express connection string

Is there a difference between sql server connection string and the express vesion?! ...

How should I pass a table name into a stored proc?

I just ran into a strange thing...there is some code on our site that is taking a giant SQL statement, modifying it in code by doing some search and replace based on some user values, and then passing it on to SQL Server as a query. I was thinking that this would be cleaner as a parameterized query to a stored proc, with the user valu...

"Impersonated" User Not Propagated To SQL Server 2000

I need to "impersonate" a user in a VB.NET 2008 WinForms application, so that the application can accept the Active Directory login of any user on a PC regardless of who is actually logged in to Windows. I want the application's My.User to be the AD account of the person who logged in to the application. I succeeded in this with the foll...

How to make DDL Trigger for a specific table?

I'm trying to create a DDL trigger for a specific table and this is the best I could come up with: CREATE TRIGGER MyTrigger ON DATABASE FOR DDL_TABLE_EVENTS AS DECLARE @EventData xml SET @EventData=EVENTDATA() IF @EventData.value('(/EVENT_INSTANCE/ObjectType)[1]', 'varchar(50)')='TABLE' AND @EventData.value('(/EVENT_INSTANCE/O...

Are temp tables in SQL Server multiuser safe?

Is a temp table local to the thread or global to the server? ...

read output stored procedure that returns multiple recordsets in sql 2005

I'm trying to programmatically access the result of executing the system stored procedure sp_spaceused. if you pass the name of an object as a parameter, the sp returns a recordset which you can read like this CREATE TABLE #TempTable ( [Table_Name] varchar(50), Row_Count int, Table_Size varchar(50), Data_Space_Used var...

Get the inverse of a join?

I am using SQL Server 2005. I have three tables - Users, Groups, and GroupUsers. GroupUsers contains the two PKs for a many-to-many relationship. I have a view to get all the user information for a group as follows: SELECT * FROM GroupUsers JOIN Users ON GroupUsers.UserID = Users.UserId I want to create the inverse of this view - I w...

Add Package-scope Variable to Output (SSIS)

I'm trying to create an SSIS package to move data from an Excel spreadsheet into a SQL Server 2005 table. It's mostly going okay, considering that this is the third time I've tried to build a package at all (not what you'd call a flat learning curve). The one thing I'm just not getting through my skull is how to include a package-scope...

SQL: Select maximum value for each unique key?

Sorry, I'm not sure how to phrase that and I'm really not very good with SQL. The db engine i SQL Server Compact. I currently have this query: SELECT * FROM Samples WHERE FunctionId NOT IN (SELECT CalleeId FROM Callers) ORDER BY ThreadId, HitCount DESC Which gives me: ThreadId Function HitCount 1 164 6945 ...

looking for some cool Silverlight chart Demos

Hello everyone, I am currently using Reporting Service of SQL Server 2008, and I think the user interface is not very elegant. And I want to use Silverlight as user interface to render reporting service backend data. Two questions, Is it possible? Reporting Service exposes interface which Silverlight could retrieve data and render? I ...

SQL Server output parameter issue

I am using SQL Server 2008 Enterprise. I am learning OUTPUT parameter of SQL Server stored procedure. For example, stored procedure sp_add_jobschedule has an OUTPUT parameter called schedule_id. http://msdn.microsoft.com/en-us/library/ms366342.aspx My confusion is, looks like OUTPUT parameter could be provided an input value and also r...

intersect time intervals and generating new ones depending on intersect-results

hi there, i've got two tables with time intervals and some settings for each interval, eg 2009-01-01T06:00:00 2009-01-04T14:00:00 1 0 2009-01-04T22:00:00 2009-01-07T06:00:00 2 1 2009-01-07T06:00:00 2009-01-09T13:00:00 2 2 2009-01-09T22:00:00 2009-01-14T06:00:00 3 0 and 2009-01-04T16:00:00 2009-01-05T01:00:00 2 0 2009...

how to see active SQL Server connections?

Hello everyone, I am using SQL Server 2008 Enterprise. I want to see any active SQL Server connections, and the related information of all the connections, like from which IP address, connect to which DB or something. Any existing tools to solve this issue? thanks in advance, George ...

how to see SQL Server cache hit rate?

Hello everyone, I am using SQL Server 2008 Enterprise. I will issue a lot of query to SQL Server. And I think SQL Server itself will use some optimization internally, like pre-fetching data into SQL Server internal data cache or accessing frequent requesting data from cache before load from physical page file to improve performance. An...

SQL Server: View and DateTimes

I have the following table Foo: start | end | cause -------------+-------------+---------- 2007/12/22 | 2008/02/12 | 2 2008/03/18 | 1900/01/01 | -1 there are stored various periods of time. cause '-1' and end '1900/01/01' means the time period has no end. Under certain conditions, the application using thi...

help with sql date query

I have date field that holds the birthdate. I want to calculate the age somthing like [today] - [born date] How can I do it with a SQL Server 2008 query ? And why does the date look like 01-02-2009 when I need it 01/02/2009; how do I achieve that? Thanks a lot for any help ...

SQL Server linked server performance

Hello everyone, I am using SQL Server 2008 Enterprise. And I am using Linked Server technologies to link another SQL Server 2008 Enterprise instance from another server. I write TSQL to manipulate objects (e.g. tables) from both server instances. My question is, for linked server, is there a big performance issue? If yes, what is the k...