The data layer of my ASP.Net app calls a stored proc to get a small (one record) amount of information about a visitor upon login. I pass in their phone number and the sproc, using a simple SELECT, passes back 5 fields, the first of which is the primary key, a BIGINT. My data layer gets the DataRow and tries to create a data object wit...
I am using SQL Server 2005 and I have to relationships going into one table. I had to turn off " Enforce Foreign Key Constraints" because I have 2 relationships going into the same table.
However I want to put cascade delete on.
I thought if I have cascade delete on both of these relationships and if I say deleted something from on of...
I'm a little worried about the default retention period in SQL Server 2008 Change Tracking (which is 2 days).
Is it a good idea to set this period to eg. 100 years and turn auto cleanup off or will it bite me back in the future with excessive storage usage and/or performance degradation? Anyone has experience in that matter?
...
I am installing SQL server 2008. I have installed .Net framewok 3.5.
Then I got folder SQL Server 2008.Then I performed following steps-
In that I clicked configuration Tools.
Then I clicked SQL Server Installation Center.
I clicked "Installation" hyperlink on left side.
Then I clicked "New SQL server stand-alone installation or add ...
Is there a way to capture STATISTICS IO and TIME within T-SQL for logging.
...
I have a table similar to the example shown below. I would like to be able to select the two most recent entrys for each accountNo. I am using Microsoft SQL 2000.
Thank you for any help that you can provide.
AccountNo, DateOfOrder, OrderID
-----------------------------------------
123, March 1 2010, 1
222, March ...
Hi All
I have two stored procedures, the first one calls the second ..
If I execute the second one alone it takes over 5 minutes to complete..
But when executed within the first one it takes little over 1 minute..
What is the reason !
Here is the first one
ALTER procedure [dbo].[schRefreshPriceListItemGroups] as
begin tran
delete from...
Hi,
I know NULL is not zero... nor it is empty string. But then what is the value of NULL... which the system keeps, to identify it?
...
I have 2 tables. To simplify:
Table 1, users:
userId int,
userName nvarchar(50)
Table 2 , messages:
msgId int,
msgFrom int,
msgTo int...
msg1 and msg2, both contain userId. Now I want to get all messages, but instead of the msgFrom I want the user name. I know what to do here:
select tabMessages.*, tabUsers.userName ...
Hi
I need to SELECT INTO a temp table multiple times with a loop but I just can't do it, because after the table created by SELECT INTO you can't simply drop the table at the end of the loop, because you can't delete a table and create it again in the same batch.
so how can I delete a table in a stored procedure and create it again?
i...
I need help with select statement in SQL Server / T-SQL
My table looks like this:
Id (int)
QuestionId (int)
GenreId (int)
QuestionScore (int)
I want to select random N rows from this table so that maximum number of same GenreId in the result set is less than X for all GenreId-s except one. For that one GenreId, I need row ...
Hi,
I have a database "temp" with table "A". I created new database "temp2".
I want to copy table "A" from "temp" to a new table in "temp2" . I tried this statement but it says I have incorrect syntax, here is the statement:
CREATE TABLE B IN 'temp2'
AS (SELECT * FROM A IN 'temp');
Here is the error:
Msg 156, Level 15, State 1, Li...
Here's what I have. User enters values into text boxes (personal information etc.) and then presses a save changes button. The values in these text boxes get stored in an SQL database.
The problem I have is that when updating the database using the values from the text boxes, the page refreshes and the values in the text boxes are lost...
Ever since Microsoft introduced sql-server version code-named "Madison" the massively parallel processing (MPP) has got into picture. What exactly is it and how does sql-server is going to benefit from it ?
Further is massively parallel processing (MPP) related to parallel computing ?
I read about Madison here and about parallel compu...
I'm using the below to restore a database in VB.NET.
This works but causes the interface to lockup if the user clicks anything.
Also, I cannot get the progress label to update incrementally, it's blank until the backup is complete then displays 100%
Sub DoRestore()
Dim svr As Server = New Server("Server\SQL2008")
Dim res As Rest...
I want to use the built-in membership functionality that comes with the SQL Server Express database that is created when the project is built but I want to use it in my SQL Server database without having to re-create the wheel so to speak.
...
Hello,
I have a stored procedure that is dynamically building a query. The where clause associated with this query is based on filter values selected by a user. No matter what I do though, the where clause does not seem to get set.
-- Dynamically build the WHERE clause based on the filters
DECLARE @whereClause as nvarchar(1024)
IF (@ha...
I want to do a database-side string concatenation in a Rails query, and do it in database-independent way.
SQL-92 specifies double-bar (||) as the concatenation operator. Unfortunately it looks like MS SQL Server doesn't support it; it uses + instead.
I'm guessing that Rails' SQL grammar abstraction has solved the db-specific operator ...
I'm writing a multiuser application (.NET - C#) in which each user's data is separated from the others and there is no data that's common between users. It's critical to ensure that no user has access to another user's data.
What are some approaches for implementing security at the database level and/or in the application architecture ...
For example,
the start date = '20100530' and
the end date = '20100602'
How can I write a SQL to display the below result?
month: may, 2 days
month: June, 2 days
...