sql-server

Speed up SQL Management Studio's Object Explorer on a shared hosting SQL Server environment

Hello! When I expand the "databases"-folder in the Object Explorer in SQL Management Studio Express it tends to load ALL databases that exists on my shared host. This results in very long delays (the app freezes totally and sometimes also crashes). I just need to see the object tree of one database. Is there any way to overcome this i...

Building SQL Query

Hi all, I need some help to build SQL Query. I have table having data like: ID Date Value1 Value2 Code 1 12/01/2009 4 3.5 abc 2 12/02/2009 3 4.0 abc 3 11/03/2009 6 8.5 xyz 4 11/01/2009 2 5.5 abc 5 11/02/2009 4 6.0 xyz 6 12/03/2009 5 7.0...

Is SQL replication the answer?

Hi, For our application(desktop in .net), we want to have 2 databases in 2 different remote places(different countries).Is it possible to use replication to keep the data in sync in both the databases while application changes data?. What other strategies can be used? Should the sync happen instantaneously or, at a scheduled time? What ...

how to get SQL Server table data completely by small parts without index

I have SQL Server table without any indexes, and i can not add them. There are millions of records in that table, and i can not get all records with single query because of insufficient memory. How can i get all records in small portions - for example 100 records per portion? ...

Are SQL CREATE SCHEMA and CREATE DATABASE equivilent?

Hello, I'm having trouble determining the difference between CREATE SCHEMA and CREATE DATABASE. I'm of the understanding that they are the same and that it's usual to use the latter. Is that so? Thanks! ...

SQL Server CASE WHEN and IN construction

Having a problem with a WHERE search statement would like to use a construction like.. WHERE f.foo IN CASE @bar WHEN 'BAR' THEN ('FOO','BAR',BAZ') WHEN 'BAZ' THEN ('FOOBAR','FOOBAZ') END or WHERE CASE @bar WHEN 'BAR' THEN f.foo IN ('FOO','BAR',BAZ') WHEN 'BAZ' THEN ...

How do I include the newlines from syscomments in SQL Server?

I'm building a script to get all the triggers in the document, but I want to include newlines. I'm copying and pasting this into excel in order to then quickly generate some mandated documentation, but all the contents from the text column end up being generated without newlines. The line I'm currently using, which produces truncation i...

C# import textfile into SQL table

I have a bunch of 2 line (with header row) '|' delimited text files. I need to import this into a specific SQL table and i'm having a hard time with the command. Any help is appricated. string sqltable = ("dbo.SLT_C" + "60" + "Staging"); string[] importfiles= Directory.GetFiles(@"K:\jl\load\dest", "*.txt") SqlConnectio...

SQL Server: enable remote connections without SSMS

I've got a SQL Server Express 2008 install on my web server, which by default does not allow remote connections (probably a good thing.) I opted not to install SQL Server Management Studio Express along with it for disk space and other reasons. I need to enable remote connections but any instructions I can find involve using SSMS to ch...

Can I do a foreign key lookup while importing data into SQL Server 2005?

Background I have a spreadsheet of data that I'm importing into SQL Server 2005. I'm using the Import Wizard in Management Studio to do this. Problem I'm importing the data into Table A. Table A has a foreign key reference to Table B. My spreadsheet contains a value in Table B and I need the key for that value so I can put it into Ta...

how to force a lock to be obtained in SQL Server?

Hello, I am working on making an application run on both Postgres and SQL Server. in PostgreSQL you can do something like lock mytable exclusive; which would keep the entire table from being written to(insert/updated). I need the entire table to be locked while certain things are updated(and RIDs can not be changed or else it'll scre...

is it possible to use linq on "sql server project"

I'm using visual studio 2008. How can i use linqtosql on the sql server project? ...

SqlCe Where clause problem

I have a simple sqlce database, trying to update a row in a table. The following command works: UPDATE ConsoleUsage SET TotalCircuits = 123 But the above command updates all rows, so what I want is this: UPDATE ConsoleUsage SET TotalCircuits = 123 WHERE Index = 912 The intent is to update a single row in the table. But this comma...

Fill a Recursive Data Structure from a Self-Referential Database Table

This question refers to http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx Let's say I have a table that looks like this: And I have a recursive data structure that looks like this: public class TreeNode { public TreeNode(){} public string NodeId { get; set; } public string ParentId...

Search from file vs. search from sql ntext field

I'm creating news portal site. this saves to many news.Every news has html data. i'm using SQL Server 2005. I have 2 choices. Save news data to ntext field. Save news data to html file and save file name to nvarchar field. What is best way to good performance and quick search operation. If i choose second way, when i search from news...

Install reporting services 2005 on a web server

I have a SQL box and a web box; the SQL box is close to capacity. I'd like to install reporting services and thought about installing it on a SQL instance i would install on the web box, and only use that instance for reporting services. Is this a good option? What pitfalls will I have if I try to do this? ...

is there a difference between a select statement inside a transaction and one that is outside of it

I was just wondering if that default READ COMMITTED isolation level somehow makes the select statement act different inside of a transaction than one that is not in a transaction, anybody knows ? I am using MSSQL ...

Query table names based on the column information

I want to query a set of tables based on the column name, type, etc. Basically without knowing the name of a table I want to query the database for all tables capable of storing the data into. I have this query but I'm not sure if it's very efficient. I was wondering if there is a better way. SELECT O.TABLE_NAME FROM INFORMATION_SCHEM...

Will unique RIDs ever "overflow" ?

Hello, I am making an application to run on both SQL Server and PostgreSQL, so I am asking this question about both of them. What happens whenever you create a unique primary key(using a sequence or auto-increment type thing) and you hit over 4 billion records(32 bits)? I'm not saying that our table will have 4 billion records but rath...

Is my execution plan trying to trick me?

I am trying to speed up a long running query that I have (takes about 10 minutes to run...). In order to track down what part of the query is costing me the most time I included the Actual Execution Plan when I ran it and found a particular section that was taking up 55% (screen shot below) This didn't quite seem right to me so I add...