sql-server

Group SQL tables in SQL Server Management Studio object explorer

I have a table which has approximately sixty tables, and other tables are added constantly. Each table is a part of a schema. A such quantity of tables makes it difficult to use Microsoft SQL Server Management Studio 2008. For example, I must scroll up in object explorer to access database related functions, or scroll down each time I n...

Best Practices - Stored Procedure Logging

If you have a long running SP, do you log somehow it's actions or just wait for this message? "Command(s) completed successfully." I assume, that there can be plenty solutions on this subject, but is there any best practice - a simple solution that is frequently used? EDIT I've found an interesting link on this subject http://we...

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...

SQL Server float datatype

The documentation for SQL Server Float says Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly. Which is what I expected it to say. If that is the case though why does the following return 'Ye...

Update String Columns without Using Single Quotations - General Question

UPDATE CustomerPhone SET PhoneTypeID = 7, PhoneNumber = 999-444 WHERE CustomerID = 500 AND PhoneNumber = 9-1-1; PhoneNumber is of type varchar(20) whereas PhoneTypeID and CustomerID are of type int. I'm running the above statement in SQL Server, it works fine. I wonder how come it works? I thought any string value has to be put betwe...

Question About TransactionScope in .NET

using (TransactionScope scope = new TransactionScope()) { int updatedRows1 = custPh.Update(cust.CustomerID, tempPh1, 0); int updatedRows2 = custPh.Update(cust.CustomerID, tempPh2, 1); int updatedRows3 = cust.Update(); if (updatedRows1 > 0 && updatedRows2 > 0 && updatedRows3 > 0) { scope.Complete(); } } ...

Datagrid doesn't refresh on changed data

Hi. Is there any way to have a datagrid listen to the database and automatically update the data if the database data is changed? I use a SQL Server database. I'd like to use Linq-2-SQL if possible thx in advance :D ...

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 ...

How to automatically re-run deadlocked transaction? (ASP.NET MVC/SQL Server)

I have a very popular site in ASP.NET MVC/SQL Server, and unfortunately a lot of deadlocks occur. While I'm trying to figure out why they occur via the SQL profiler, I wonder how I can change the default behavior of SQL Server when doing the deadlocks. Is it possible to re-run the transaction(s) that caused problems instead of showing t...

SQL Server combining 2 rows into 1 from the same table

Hi, I have a table with an JobID (PK), EmployeeID (FK), StartDate, EndDate containing data such as: 1, 10, '01-Jan-2010 08:00:00', '01-Jan-2010 08:30:00' 2, 10, '01-Jan-2010 08:50:00', '01-Jan-2010 09:05:00' 3, 10, '02-Feb-2010 10:00:00', '02-Feb-2010 10:30:00' I want to return a record for each EndDate for a Job and then the same emp...

All embedded databases fail to open connections

Hi, I'm working on a winforms desktop application that needs to store data. I made the really bad decision to try and embed a database. I've tried: SQLite VistaDB SQL Server Compact In each case, I was able to generate a Entity Framework Model over the basic schema I've created. I have an event that adds data that I've been using...

How can I query all rows that are currently before data specified in one column in table?

I need to get all rows tha are valid, ValidDate is column that shows how long these database items are valid. I need to get only valid items from the database. How can I do that? I use SQL Server. ...

sql server db deployment script ignoring constraints etc until commit

Hi all, I am planning on doing a database deployment script for sql server 2005. Currently we have a tool that will run all of the tables, foreign keys, indexes and then data, each of which is located in a separate file with a certain extension (eg. tab, .kci, .fky) and the tool just runs *.tab, *.kci, *.fky into the db etc. Could I p...

insert SQL dummy column

HI there.. this is a bit hard to explain so i will show code of the update equivalent .. declare @dummy as int; UPDATE pages SET @dummy = 0 ,field ='asdsa' ... etc because i am writing a code generator it gets messy trying to determine if a comma is needed or not.. i am having this problem with inserts now.. ive trie...

How to perform split operation on strings and attach to specific ids using SQL SERVER 2000(Without cursor)?

I have a table wuth the folowing structure PickupPointCode LocationCode ClientCode 1 LOC1 Client1/Client2 2 LOC2 Client3/Client4/Client5 3 LOC3 Client6 The desired output being PickupPointCode LocationCode ClientCode 1 LOC1 ...

Service MSFTESQL not found.

While installating MS-CRM:I got sql server errors:- 1>Service MSFTESQL not found. The specified service does not exists as an installed service -----but i can see the service is running automatically and help file says **"verify that you have local administrator permissions for the computer on which sql server is running. And if nece...

How can I get reports for last 24h in SQL?

I need to get all reports made in last 24h, table has CreatedDate column, so I need to check in database that report was created in last 24h. I know I can use getdate() to get current date, but how can I minus 24h from that attrbiute and then compare that date with CretedDate? ...

Is there an alternative of using a VBScript for enabling FileStream after SQL Server installation?

To use Filestream on a DB 3 steps must be done: 1) enable it a server/instance level 2) enable it (sp_configure) at DB level 3) create a varbinary(max) field that supports filestream (2) and (3) are done easily with T-SQL (1) is doable manually from SQL Server Configuration Manager, basically what I need is to check all the 3 checkb...

Why there is "GO" after USE db" in T-SQL examples?

Hi, Looking at the msdn, there was an example on "GO" command. Why there is: USE somedb GO ... ... It it neccesary to select db in different batch? Thanks for explanation! ...

Is the available disk space stored in the sql server (2000) master database?

I want to be able to monitor the space left on drives that various databases sit on. ...