sql-server

Query number of decimal places in a sql server resultset

I have a table which contains a field of type numeric(28,10). I would like to display the records with a monospaced font, and a matching number of decimal places so that they line up when right aligned. Is there any way to figure out the maximum number of decimal places that can be found in a given result set so that I can format accor...

is there any Benchmarking tool for available for testing SQL server CE ?

HI , is there any Benchmarking tool available for testing SQL server CE ? ...

Collation Conflict

i always got the message "Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AI" in the equal to operation." when i run the script that came from MSSQL 2005 server. btw i used MSSQL 2008. here is the script USE [database1] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --exec rsp_S...

How to protect SQL Server data file.MDF and lock .LDF from being copied ?

I Upgrade a small Ms Acces Desktop application to VB.net SqlServer Express 2008 R2, this application run on different clients LAN Networks ( about 50 ) with one dedicated Windows Server 2008 R2 and two or trhee PC-Clients. All installations have SqlServer sa password and nobody knows the password, this sa login is only for administrati...

compression, defragmentation, reclaiming space, shrinkdatabase vs. shrinkfile

[1] states: "When data is deleted from a heap, the data on the page is not compressed (reclaimed). And should all of the rows of a heap page are deleted, often the entire page cannot be reclaimed" "The ALTER INDEX rebuild and reorganize options cannot be used to defragment and reclaim space in a heap (but they can used to defragmen...

tsql to know when sql service was installed

Hi, Using Tsql, how can I find out when MS SQL server was installed? Thanks in advance ...

what is index and can non-clustered index be non-unique?

Subquestion to my question [1]: All definitions of (MS SQL Server) index (that I could find) are ambiguous and all explanations, based on it, narrate something using undefined or ambiguously defined terms. What is the definition of index? For ex., the most common definition of index from wiki (http://en.wikipedia.org/wiki/Index_(d...

SqlDatareader GetValue returning date value acording to system date format

Hi i am reading a value from a table using SqlDatareader, problem is it is always formatting the value acording to the machine date format settings. for example the original date format in the source table is saved as yyyy/mm/dd when i use SqlDatareader.GetValue in a machine that has date set as MM/dd/YY it is atutomatically converted ...

Updating record in Database

Hello, I have this form on my site where a user can enter many strings and save it to their account. But I'm not sure how to go about it. Instead of creating a whole new user, with new values, I'd just like to update a single entry in the database. For example if a user wanted to add another email address to their account, how would I...

partial lookup performance

Hi All, I have implemented partial lookup in fact table due to selection lookup having the validation in between the values of the lookup table. query as: SELECT X1, X2, X3 FROM TABLE1 WHERE X1 = ? AND ? BETWEEN X2 AND X3 --- WHERE ? ARE VARIABLES IN THE modify the SQL statement in the advanced tab of lookup. I have calculated the...

Data Gridview in C# Windows application

How to move to next cell in datagridview when the user clicks enter and atlast it has to move to next row. And How to add two column and display in third column when a user press or moves to fourth column in datagridview in C# windows application. ...

restore sql database

I want to restore a database using asp.net web application in C#.. Can anyone help me with this? ...

how to connect ms sql database from one computer to the other?

I have a computer(computer A) which the ms sql installed, and I have another computer(Computer B) in which the application resides. I want to connect the ms sql database from computer B to computer using this application?How will I do that? What is the connection string should I use, firewall settings, database configutions, etc? ...

Where clause with insert statement

Hi All, Is it possible to use where clause with insert statement. In my scenario im not getting how to use update query as the subquery returns more than one values. My query goes like this. INSERT EntityAttributeValue ( EntityID ) SELECT ID FROM (SELECT ID FROM (SELECT ID, ...

Do we still need stored procedures when using compiled queries?

When using compiled queries in entity framework (or linq-to-sql) in combination with SQL Server, is there actually still any performance benefit in using stored procedures? Compiled queries will be cached as parameterized queries, so performance should be near equal to stored procedures. Is there any situation where stored procedures wo...

How to select unique rows only in sql?

I have two columns, senderUserID and recieverUserID in Messages table. I select senderUserID and recieverUserID where current receiver sent a message to current sender in the past. I select 10 rows only each time but sometimes in this table senderUserID appears more than once when i need that only senderUserID will be unique, while recie...

Will modifying any row data fragment my clustered index?

I now understand that a clustered index contains all of the row data, not just the index fields. I'm trying to understand the implications of this in regards to fragmentation. Say we have a table like this: create table Files ( ID uniqueidentifier not null, Field1 nvarchar(300) null, Field2 nvarchar(300) null, Field3 nv...

Help with T-sql special sorting rules

I have a field like: SELECT * FROM ( SELECT 'A9t' AS sortField UNION ALL SELECT 'A10t' UNION ALL SELECT 'A11t' UNION ALL SELECT 'AB9F' UNION ALL SELECT 'AB10t' UNION ALL SELECT 'AB11t' ) t ORDER BY sortField and the result is: sortField --------- A10t A11t A9t AB10t AB11t AB9F Actually I need ...

Sql Server 2008 r2 does not recognize process when triggered

Hi Everyone. i've installed SQL Server 2008 R2 On my machine (my machine runs windows server 2003) some of the tables inside my db are fireing triggers (when insert,delete,update occurs) the trigger result supposed to reach some process (triggersReceiver.exe via shared memory) that waits for the triggers. the problem is that the SQL Serv...

SSIS & WMI Event Watcher & Data Flow Task

Hello! I've got a WMI Event Watcher in my SSIS package which successfully watches a folder for a file. (i.e. in debug mode, it turns green when I copy the file into the watched folder.) I've added a a data flow task to import this (excel) file into a SQL database. Trouble is the data flow task never fires. So, (a) am I using the cor...