sql-server

Get the id selected in an SP executed in an other SP

i have an SP that executes 1 SP at the moment EXEC mpSPAccess.PostIdSelect @PostDate = @TodaysDate The SP does something like this (very simplyfied :)) SELECT id FROM Post WHERE DateCreated = @PostDate After this SP is Executed i want to use the id i got from PostIdSelect as an parameter for more SPs Like this: EXEC mpSPAccess.Ge...

TRANSACTION ISOLATION LEVEL REPEATABLE READ in SQL Server

What are the risks or performance degradation when using SET TRANSACTION ISOLATION LEVEL REPEATABLE READ? We have some SP that are called from BizTalk services. We are getting deadlock sometimes. If we change the isolation level, what are the risks and possible perfomance degradations? ...

how to calculate database transaction count per second and database growth

Hello , I need to learn about calculating database load of a project . Lets assume that the events below are firing when an insert is completed. Insert a new record to table1 Get the uniqueid from inserted and insert the uniqueid to another table , with some other parameters table1 is a cumulative dataware , so select count(1) from ...

FILESTREAM and partitioned storage

I have a question about the current implementation of the FILESTREAM type for SQL Server 2008. Say I have a table that stores my documents using FILESTREAM. After a year, I want to archive (move) off a number of these documents to a different server. Is it possible to have FILESTREAM documents on two separate drives? Or do they have ...

How to store fungible data?

I am writing a .net application that is taking form information to do some car loan prequalification calculations and will store this in a database. The trouble is every field should allow the user to type any kind of string data into it and preserve it into the database. Most of the fields need to be converted to decimal or integer v...

A simple but challenging SQL Question, at least I couldn't find a way out except doing it externally (c#).

Hello All, I have an SQL Table which consists of 1 column only Column Name A A A B B B B C D D E I need an SQL Code that returns the cut points. For the table above, it will return this: Column Name 3 7 8 10 11 3 is the end of A's and 7 is the end of B's and 8 is the end of C's and so on... Let's see what can...

How can I tell if a database table is being accessed anymore? Want something like a "SELECT trigger"

I have a very large database with hundreds of tables, and after many, many product upgrades, I'm sure half of them aren't being used anymore. How can I tell if a table is is actively being selected from? I can't just use Profiler - not only do I want to watch for more than a few days, but there are thousands of stored procedures as well,...

How to detemine if the default value was supplied to stored procedure?

Hi, There's a stored procedure with the parameter that may take default value CREATE PROCEDURE [dbo].[FooSP] @FooParam INT = 15 AS So is there a way to determine whether that SP was called with or without setting the @FooParam value. IOW, is there a way to determine if the user called exec dbo.FooSP(15) or exec dbo.FooSP() ...

Can I make a report for a stored procedure with unknown amount of columns?

I have a stored procedure, that generates some columns dynamically. I want to use Crystal Reports as a reporting service and, in particular, I need to generate report from this stored proc data. It's a poll-result report and for each poll act there is a row with it's ID and answers to the questions(one column for each question with quest...

What's the fastest way to check the availability of a SQL Server server?

I have an MS Access program in use in multiple locations. It connects to MS SQL Server tables, but the server name is different in each location. I am looking for the fastest way to test for the existence of a server. The code I am currently using looks like this: ShellWait "sc \\" & ServerName & " qdescription MSSQLSERVER > " & Qt(f...

MS Jdbc driver sqljdbc 2.0 driver fails to connect to SQL Server 2008

Hi all, We have a well-defined problem that points to a problem with Microsoft's JDBC 2.0 driver for JDK 1.6 ("sqljdbc4.jar"). I may be wrong. I've been wrong before. I wanted to see if I'm missing anything. any insights? Anyone seen this before? Usecase: use ant "sql" task to run a simple sql query. All queries fail jdbc driver...

SQL Server Reporting Services 2005 - How can I get the report to scale to one page wide when printing?

I have a report and it seems so insist on printing in portrait mode and splitting the report across two pages. How can I make the web version specify landscape automatically, and also have it scale to fit on one page? ...

LUcene.NET how ot search forms of words? (as in SQL Server)

Hello All, How can I create index and then search like in SQL Server FTS? I.e. data is indexed once and then user can search: exact matching: "apple", "monkey", "drunk" etc... forms of words: enter "drunk" and find "drink", "drank", "drunk" enter "apples" and find "apples", "apple" context: "app*" and find "apple", "application" e...

Best way to download data from Windows Azure Table

I need to download data from windows azure table storage back to a SQL Server database inside the office network every night. There could be up to 100,000 entries in the table. What’s the most efficient way to do this (i.e. the method that costs the least)? ...

SSAS: Weird error when Setting up Mining Structure

Hello, This is very odd; I setup a simple mining structure, and when I go to process it, I get this error. Doesn't point to the file the error is in, lists line and column as zero. What would this be related to? The ddl100_100:HoldoutMaxPercent element at line 184, column 38 (namespace http://schemas.microsoft.com/analysisservices/20...

SQL Server requests time out as TempGetStateItemExclusive is getting called continuously

I run a site with decent traffic (~100,000 page views per day) and sporadically the site has been brought to its knees due to SQL Server timeout errors. When I run SQL Profiler, I see a command getting called hundreds of times a second like this: ... exec dbo.TempGetStateItemExclusive3 @id=N'ilooyuja4bnzodienj3idpni4ed2081b',... ... ...

What is SQL Server doing between the time my first record is returned and when my last record is returned?

Say I have a query that returns 10,000 records. When the first record has returned what can I assume about the state of my query? Has it finished and is just returning records from the server to my instance of SSMS? Is the query itself still being executed on the server? What is it that causes the 10,000 records to be slowly ret...

Why doesn't STDifference between a LINESTRING and a POINT on the line string yield a MULTILINESTRING of the two pieces?

DECLARE @Route geography SET @Route = geography::STLineFromText('LINESTRING(-0.175 51.0, -0.175 59.0)',4326) DECLARE @Route2 geography SET @Route2 = @Route.STDifference(geography::STPointFromText('POINT(-0.175 52)', 4326)) SELECT @Route2 Why does @Route2 evaluate to LINESTRING (-0.175 59, -0.175 51) instead of a MULTILINESTRING consi...

SQL Server 2005 query multiple Access databases?

Is there a way to get SQL Server 2005 to query 3 or more separate Access databases (each returning 1 record) in one SQL statement? ...

Notification for finishing SQL Server query

Is there any plugin or tool give notification when a SQL Server query finishes? Maybe through email/ popup window. Thanks! ...