Tag: database

Most efficient way to Read from sql server table, modify and write to a different sql server table

I have two tables where I need to extract data from one, do some modifications to that data and then write it to a different table. I was wondering what is the most space/time efficient way to do this. Is it better to read one record, modify and write the single record to the other […]

Cannot use WITH statement two times

I wan’t to create a view that is constructed like this: (simplified) Create VIEW viewAll AS With TempLevel1 AS ( SELECT statement ) With TempLevel2 AS (SELECT * from TempLevel1) SELECT * from TempLevel2 The problem is that I cannot use With statement like this because of the following error: Incorrect syntax near the keyword […]

What is a clean way of passing a list of ints between stored procedures?

I have a stored procedure which results in a temporary table populated with INTs. I also have another stored procedure which I want to take in a list of INTs to perform processing on them. As far as I know there isn’t a clean way to pass a list of values between stored procedures, so […]

JPA with HIBERNATE insert very slow

I am trying to insert some data to SQL Server 2008 R2 by using JAP and HIBERNATE. Everything “works” except for that it’s very slow. To insert 20000 rows, it takes about 45 seconds, while a C# script takes about less than 1 second. Any veteran in this domain can offer some helps? I would […]

Query to output not existing data

Table A: id Name 1 a 2 b 3 c 4 d 5 e Table B: id Name 3 c 4 d 5 e Here, id is the primary key connected to Table B. I need output like this:- id 1 2 That means, which ids in Table A are not present in Table B

Slow but simple Query, how to make it quicker?

I have a database which is 6GB in size, with a multitude of tables however smaller queries seem to have the most problems, and want to know what can be done to optimise them for example there is a Stock, Items and Order Table. The Stock table is the items in stock this has around […]

what is good, explicite cursor in backend or loop in front end?

what is good,using explicite cursor,while loop on database side OR using loop on front end (application side programm)??? Edited:- Hi,if I want to iterate and i am using ado.net asynchronous(disconnected) connection (ie.I have a datatable and i am applying for loop on datatable in front end) — In this case,If i want to iterate which […]

How to have database name as variable in an SP?

We use stored procedures exclusively here, and that raises a little problem. We cross reference two different databases like dbdev..table1 in dev, dbqa..table1 in qa, and dbprod..table1 in production. So every time we deploy to a different environment, we have to search and replace from dbdev to dbqa or dbprod. Is there a way to […]

How to connect to a database project?

I have a team working on a project. For the purpose of collaboration we are using Team Foundation Server. Now we want to create a shared database so that each team member can connect to the database, manipulate it, and retrieve data. I’ve already created a SQL Database Project and I’ve added it to TFS […]

Virtualize the database server or the web server?

In a web application architecture with 1 app server (IIS) and 1 database server (MSSQL), if you had to pick one server to virtualize in a VM, which would it be: web or db? Generally speaking of course.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.