sql-server

Is there a static value defined in the .NET framework for sql server's date range?

Is there a static value defined in the .net framework library similar to DateTime.MinValue and DateTime.MaxValue except with values that reflect Sql Server's datetime datatype range? (January 1, 1753 - December 31, 9999) ...

How do I execute a very long dynamic sql statement on SQL Server 2000?

Hello, I generate an sql string select statement that is around 25k characters long. Unfortunately the production server is SQL 2000. Is my only option to break the string up into 4k nvarchars? --ex. DECLARE @s1 NVARCHAR(4000) DECLARE @s2 NVARCHAR(4000) DECLARE @s3 NVARCHAR(4000) DECLARE @s4 NVARCHAR(4000) DECLARE @s5 NVARCHAR(4000) DE...

t-sql combine column values

Based on the following table ID Description ReleateID ----------------------------------- 1 some desc1. 50 1 some desc1. 60 2 some desc2. 50 2 some desc2. 70 3 some desc3. 80 How to get the following output ID Description AllRelatedIDs ---------------------------------- 1 some desc1. 50,60 2 some desc2...

Can I set the isolation level in the connection string?

How can I set the isolation level of all my SqlCommand ExecuteNonQuery calls to be read uncommitted? (connecting to a SQL Server 2008 enterprise instance) I am simply transforming static data and inserting the results to my own tables on a regular basis, and would like to avoid writing more code than necessary. ...

Cron Job with R and MSSQL

This is probably going to be an underspecified question, as I'm not looking for a specific fix: I want to run a machine learning algorithm on some data in a MSSQL database. I'd like to use R to do the calculations -- which would involve using R to connect to the database, process the data, and write a table of results back to the datab...

SQL Server XML Data Type and QUOTED_IDENTIFIER

Can anyone provide insight into this? I've developed an import process using an XML data type. After the data is inserted in to a table by the import sProc I run another procedures to update another table with the imported table. The update procedure throws an exception if it is created with SET QUOTED_IDENTIFIER OFF. I'd like to under...

What advantages does a Document-based database have over a Relational database?

For example: Microsoft SQL Server vs. CouchDB. The main benefit for me with CouchDB is that you can access it from pretty much anywhere! What advantages does a document based database have over a relational one? Where would a document based db be a better choice over a relational? ...

The difference between annotating fields and methods in JPA (Hibernate)?

Are there any statements in JPA spec or official docs about certain JPA implementations which describe the behavior when we annotate entity's methods and when we annotate entity's fields? Just a few hours ago I met an ugly problem: I use JPA (via Hibernate, but without anything Hybernate-specific in java code) with MS SQL Server. And I ...

Transforming Table into different Table

I have a table like this: RowID | ProductDescription1 ----------------------------------------------------- 1 | 0296620300-0296620399; 2 | 0296620400-0296620499;0296620500-0296620599; 3 | 0296620600-0296620699;0296620700-0296620799; I want to become like this: NewRowID | Start | End | SourceRowID ------------...

how can i convert one row of a database to two

i have a table with the column id, itemID and locationId. i have now split one locationId into multiple ones so i want to: Update all records where locationId is 10 and have two rows where locationId is set to 11 and 12 (ItemId would be the same for both rows) So to start i have: Id ItemID LocationID 1 1 10 and i want to ...

SQL Server: SQL queries compared to general programming

I'm just starting out with SQL Server 2008 Express and spent the last hour or so trying out some basic queries. How does SQL scripting (correct term?) compare to general computer programming? Is writing SQL queries as involved, lengthy to learn, needs as much practice, etc. as software development? Is writing advanced SQL queries compara...

How to increase the internal resources to SQL server 2005?

Hi All, I am getting this error when i try to ran my query. "Query Processor ran out of internal resources". ...

Migrating Stored Procedures into application

All of those disadvantages of stored procedures (database portability etc.) I am now facing. We are going to migrate our VB.Net/ASP/SQL Server application to something like Mono/Postgresql and fully internationalize. One of the many issues we face is that we have 800-900 stored procedures. What we are thinking of doing is moving the log...

Database Designing: An art or headache (Managing relationships)

I have seen in my past experience that most of the people don't use physical relationships in tables and they try to remember them and apply them through coding only. Here 'Physical Relationships' refer to Primary Key, Foreign Key, Check constraints, etc. While designing a database, people try to normalize the database on paper and kee...

Valid Stored Procedure not returning any results

I have the following Stored Procedure ALTER PROCEDURE [dbo].[bt_BizForSale_GetByID] ( @ID int ) AS SET NOCOUNT ON SELECT dbo.bt_BizForSale.UserID, dbo.bt_BizForSale.VendorType, dbo.bt_BizForSale.BusinessName, dbo.bt_BizForSale.isEmailSubscriber, dbo.bt_BizForSale.isIntermediarySubs...

Run script on multiple DBs(SQL Server)?

Hello, lets say I have some update script: update sometable set somecolumn = 'somevalue' where xyz = 0 Now lets say I have multiple databases, like DB1, DB2, DB3 and so on. How coul I run this script on all of them without doing it manually? Thanks :) ...

csv column contain mix datatype connot read all cell data using oledb provider

hi my csv contain mix datatype f.ex. in cell E8 data format is date, and other data in this E column are string. i use this connetion string in classic asp ,VB Script and back end SQl server ChekCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Path1 & ";Extended Properties=""text;HDR=YES;IMEX=1;FMT=Delimited""" Set rs1 = ChekC...

Exporting data from SQL Server to Excel

Hi, i;m trying to automate the exporting of data from an sql server table to an excel using this script EXEC sp_makewebtask @outputfile = 'C:\testing.xls', @query = 'Select * from HCIndonesia_20Jul2010..Combine_Final', @colheaders =1, @FixedFont=0,@lastupdated=0,@resultstitle='Testing details' but i;m getting an er...

SQL 2000, Access Query

Hi, I have a SQL database where one of my fields 'Status' has one of 10 entries in it (not from a dropdown list). I let some people have access to the data through an Access database, they can add and modify entries. My question is, in Access, how can I make it so that the 'Status' field is a drop-down list from which the users can ch...

Optimize lots of queries

I have a list of upwards 3,000 decimal values and for each one I need to lookup another decimal value from a SQL Server database. Currently I'm using the .Net SqlClient classes. Making 3,000 queries seems inefficient, but I'm not sure if there's a neat efficient way of combining the queries into few calls. The lookup table currently con...