sql-server

Delete All SQL Server Linked Servers on single server

Hello, Im using SQL Server Management Studio 2008 (ssms.exe) connected with a local SQL Server 2000, so I notice that every time I try enter on Linked Server option It crash inmediatly so I want to delete all the servers linkeds there for try again. What script should I use or what command on T-SQL I have to run for delete all and witho...

Getting a Subset of Records along with Total Record Count

I'm working on returning a recordset from SQL Server 2008 to do some pagination. I'm only returning 15 records at a time, but I need to have the total number of matches along with the subset of records. I've used two different queries with mixed results depending on where in the larger group I need to pull the subset. Here's a sample: S...

SQL 2008 setting compatibility level

When I try to add a data-base in SQL Server 2008 (Right clicking on Databases folder->New Database) the only compatibility options given to me in the options tab are 70, 80, and 90. However, I require the use of the DATE object, which doesn't work unless I set the compatibility level to 100. I've tried using exec sp_dbcmptlevel mydb,...

how to save a trigger in sql server enterprise manager studio

i can right click on a table and go to the Triggers folder and click "New Trigger". I can then fill out the SQL for the trigger but when i click save, it just wants to save it to a ".sql" file. How to i "commit" this trigger to the table ? EDIT: as per my comment below, i did hit execute but it wasn't showing up in the "Triggers" f...

Getting execute permission to xp_cmdshell....

I am seeing an error message when trying to execute xp_cmdshell from within a stored procedure. xp_cmdshell is enabled on the instance. And the execute permission was granted to my user, but I am still seeing the exception. The EXECUTE permission was denied on the object ‘xp_cmdshell’, database ‘mssqlsystemresource’, schema ‘sys’ Part...

Need some help understanding IO Statistics

I have a query that has a very costly INDEX SEEK operation in the execution plan. In order to track down the cause i set IO STATISTICS on and ran it. In the problem section it gave the following statistics: Table '#TempStudents_Enrollment2_____________________________________000000004D5F'. Scan count 0, logical reads 60, physi...

How do I efficiently group data in a hierarchical format in T-SQL?

I have data like this: Task | Hours 1.1 | 40 2 | 40 2.1 | 60 2.1.1 | 15 15.9 | 24 16 | 5 19.1 | 40 19.1.1 | 8 19.1.2 | 12 19.2 | 6 19.2.1 | 21 19.2.2 | 15 19.2.3 | 2 19.3 | 64 I would like to group based on the first two levels of the Task, producing this result...

Debugging stored procedures in Management studio

Is there a way to step into the Stored procedure code in SQL Management Studio. I know this is possible with Visual Studio, but I am looking for a dependable debugging solution from within Management Studio ...

How do you dynamically plug a different database into your linq to sql data classes?

Suppose you have a single web portal application that is used by a number of different clients. For reasons of security and portability, each client's data must reside in a separate database. The schema for each of these databases is absolutely identical. How does one go about accessing these separate databases from a single SQL Serve...

Subsonic 3.0 Bug?

Hi, I have a table named "data_buckets" and a column in that table named "data_bucket". When I buid the activerecord.cs, subsonic created a class name "data_bucket" (extending IActiveRecord) for the table and obviously a conflict will arise when you try to access the field "data_bucket". Is it a known issue? Is there any workaround with...

Parsing unvalidated decimals (varchar) in SQL Server

SQL Server 2005. I want a script to run in the near future when we are ready to deploy the new app. We have a lot of old data that must be moved to new tables in the new app. One such set of data is sampling hours the techs have entered, which must be converted to seconds in the new app. Sounds easy enough, but brace yourself... the ...

SQL Server multi language data support

Hi everybody! How do you setup a SQL Server 2005 DBMS, so that you can store data in different languages? My exact problem is this: in SQL Server Management Studio I'm writing an insert statement which contains German Umlauts. Text is successfully saved but reading the same value results in text without Umlaut. Consider that I have to...

SQL Server catch error from extended stored procedure

Hello I have an extended stored procedure that sends an error message. srv_sendmsg(pSrvProc, SRV_MSG_ERROR, errorNum, SRV_FATAL_SERVER, 1, NULL, 0, (DBUSMALLINT) __LINE__, buff, SRV_NULLTERM); I've set the severity to SVR_FATAL_SERVER just as a test to see if I can cause the message to throw an exc...

sql server db trigger when certain field changes

is there anyway to put a condition in a SQL server trigger to say fire when field "XYZ" changes ? EDIT: what is the correct SQL syntax to basically insert into a new field Field XZY has changes from Value A to value B ...

SqlDatasource connect to SQL Server 2008 in ASP.NET

Hi all I want to use the SqlDatasource to connect a SQL Server 2008, but it says it only support the sql server 2005. Is there any method to solve it? I use the Visual Studio 2008. Best Regards, ...

is there anyway to cache data that can be used in a SQL server db trigger

i have an orders table that has a userID column i have a user table that has id, name, i would like to have a database trigger that shows the insert, update or delete by name. so i wind up having to do this join between these two tables on every single db trigger. I would think it would be better if i can one query upfront to map use...

benefits of using unique identifiers as primary key? in sql server

as opposed to int or bigint? Also what are some drawbacks? slower performance? ...

Maintain transaction on Linked server inside a stored procedure which uses OpenRowSet command to read data from Excel file

Hi, I have a Helper DB which is on 32bit sql server and i have added a linked server of 64bit, to perform Excel Import operation as Jet.oledb driver is not supported on 64-bit sql server machine. Everything is working fine, but i have to maintain transactions for insert ,update,delete that happens on linked server database, I have co...

Datatype for storing barcodes in sql server 2005

Hai guys, What datatype you would suggest for storing barcode values in sql server 2005? ...

How to Connect Analysis Services Database from Internet?

please provide me the details on How to Connect Analysis Services Database from Internet? i am using ASp.net and Sql server 2008. ...