sql-server-2008

How to automatically generate documentation of stored procedures of SQL Server 2008?

How to automatically generate documentatation of stored procedures of SQL Server 2008 like doxygen does to codes? I read about hyperSQL but it doesn't work nice with Windows. Thanks! Gil. ...

t-sql pivot filter based on input column name

Based on following AreaState table Area State ------------------- A1 Active A1 Active A1 Active A1 Proposed A1 Proposed A2 Active A2 Proposed I want to write a stored proc that returns count of state for each of the areas. Input to the stored proc is any valid State (in this case @state is the input parameter). I was hoping ...

i want to get id through passing values in sql server 2008?

id Ptypefield Value 1 1 D 2 1 E 3 1 F 4 1 G 5 1 H 6 2 FL 7 2 IF 8 2 VVS1 9 2 VVS2 10 2 VS1 11 2 VS2 12 3 0.50 13 3 1.00 14 3 1.50 15 3 2.00 16 4 Marquise 17 4 Round 18 4 Pear 19 4 Radiant 20 4 Princess this table i want to get id no i give value like D and F this is ...

SQL Server - access to sys.views for a highly privileged user

I have case where I want a database user to have db_owner privileges with regard to one databases on the server, but be able to see absolutely nothing of other databases on the server, including, for example, the sys.databases view. I have tried denying select on this view at the master database level, but this prevents the user even fr...

oracle 11g vs Sql Server 2008

Which one better in performance and scalability ,Oracle 11g or SQL SERVER 2008 ...

Reporting services subscription reports errors, but logs don't give details

Where can I find more detail about my subscription errors. I have a data driven subscription, showing status: Done: 24 processed of 24 total; 24 errors. but my trace file ReportServerService__xxxxx.log does not show any errors. It does show the subscription ran, but just no errors. My server DefaultTraceSwitch set to 3 and also trie...

Performance of stored procedure vs scalar-valued function in Microsoft SQL Server

I am wondering about performance difference between stored procedure and scalar-valued function. For now i use mostly scalar-valued functions because i can use them inside other queries (and 99% of time they return 1 value anyway). But there are scalar-valued functions that I never use within other queries and usually i call them with s...

choose append to existing backup instead of overwrite

Hello, I have a database and I made it's first backup 2 days ago. Then yesterday I spent an entire adding new records. This morning I ran a backup, (but I selected append to existing backup set) as pictured below. I just ran a restore and I found that it wiped out all my data from yesterday and it restored it from the backup of 2 days a...

Using SMO to script table as select

SSMS allows you to right-click a table and "Script Table as"->"Select to". I thought that almost everything in SSMS was done through the SMO scripting engine, but I can't seem to find a way to do this through SMO short of looping through columns and generating the script myself. Is my Google-Fu weak, or are people just not using SMO for...

Is there any way to change the line-ending used when saving files from Sql Server Management Studio

When saving a file, I know you can click Save As and then click the Save drop-down and select the line ending style. Is there any way of configuring Sql Server Management Studio so that it will ALWAYS use Windows (Cr LF) when saving files? ...

SQL Server 2008 Bug with Fulltext Creation

I have SQL Server 2008 (Version 10.0.2531). The following annoying bug? happens, and maybe someone has a workaround: When I create a computed column which also combines values from a scalar valued function, and then add it to the fulltext index via the wizard, everything works fine. The fulltext index correctly picks up on the column a...

Approach to Selecting top item matching a criteria

EDIT: my apologies, this was a MSSQL2008 issue. I have a SQL problem that I've come up against routinely, and normally just solved w/ a nested query. I'm hoping someone can suggest a more elegant solution. It often happens that I need to select a result set for a user, conditioned upon it being the most recent, or the most sizeable...

SQL Server 2008 Express w/Adv Services Command Line Install

I'm attempting to include an install of SQL Server 2008 Express w/Adv. Services with an installation package, but am having a heck of a time getting the installation to complete. Typically, this installation will take place on brand-new servers that get shipped to new customers, but this won't always be the case: Sometimes, the install...

Create an Integrity error for an SQL Server Database for the purpose of Testing

How can I manually introduce an integrity error into my database for the purpose of testing, without totally corrupting the database so that I can still run my program. Updating with a more specific question... The actual feature that I am testing runs DBCC CHECKDB and what I am testing is that it reports a failure to the user. ...

help with t-sql data aggregation

Based on the following table Area S1 S2 S3 S4 -------------------- A1 5 10 20 0 A2 11 19 15 20 A3 0 0 0 20 I want to generate an output that will give the number of columns not having "0". So the output would be Area S1 S2 S3 S4 Count ------------------------- A1 5 10 20 0 3 A2 11 19 15 20 4 A3 0 ...

Help with simple SQL Server query

I have to tables as follows; Employees: Name nvarchar(50), Job Title nvarchar(50) and Salary int. Employers: Name nvarchar(50), Job Title nvarchar(50) I would like to select every item from the 'Employers' table where 'Job Title' does NOT show up in the 'Employees' table. I know this is a simple query but it has me stumped. I'd be ...

Remove trailing zeros from decimal in SQL Server

I have a column DECIMAL(9,6) i.e. it supports values like 999,123456. But when I insert data like 123,4567 it becomes 123,456700 How to remove those zeros? ...

Changing SQL Server Database sorting

I have a request to change the collation of a SQL Server Database: ALTER DATABASE solarwind95 collate SQL_Latin1_General_CP1_CI_AS but I get this strange error: Meldung 5075, Ebene 16, Status 1, Zeile 1 Das 'Spalte'-Objekt 'CustomPollerAssignment.PollerID' ist von 'Datenbanksortierung' abhängig. Die Datenbanksortierun...

Something confusing about FormsOf (Sql server Full-Text searching)

hi I'm using Sql Server 2008 1) A given <simple_term> within a <generation_term> will not match both nouns and verbs. If I understand the above text correctly, then query SELECT * FROM someTable WHERE CONTAINS ( *, ' FORMSOF ( INFLECTIONAL, park ) ' ) should search for either nouns or verbs derived from the root word ...

CLR: Multi Param Aggregate, Argument not in Final Output?

Why is my delimiter not appearing in the final output? It's initialized to be a comma, but I only get ~5 white spaces between each attribute using: SELECT [article_id] , dbo.GROUP_CONCAT(0, t.tag_name, ',') AS col FROM [AdventureWorks].[dbo].[ARTICLE_TAG_XREF] atx JOIN [AdventureWorks].[dbo].[TAGS] t ON t.tag_id = at...