I am currently working in C#, and I need to insert a new record into one table, get the new primary key value, and then use that as a foreign key reference in inserting several more records. The Database is MS SQL Server 2003. All help is appreciated!
...
I have a database that is stuck in single-user mode. I kill the process that obtains the "lock" on the db but when I kill it another one spawns automatically, (using the sa account). This happens even with SQL Server agent disabled. Any ideas?
...
I have only just found out about DB2 Express. I had a quick look and was unable to find a load of information about it but would be interested in hearing how people have found it compared to SQL Server Express (particularly 2008) in terms of
Ease of deployment
Ease of use and development tools
Limitations such as size or CPU limits...
Profiling LINQ queries and their execution plans is especially important due to the crazy SQL that can sometimes be created.
I often find that I need to track a specific query and have a hard time finding in query analyzer. I often do this on a database which has a lot of running transactions (sometimes production server) - so just ope...
We have a number of MS SQL Server 2005 installations (both Standard and Enterprise editions) on our webservers. From time to time I need to administrate them from home. Right now I'm using Remote Desktop to connect to my work machine, but I'd prefer to install SQL Server Management Studio on my home machine so that I can work more effici...
I have several databases, one of which contains utility functions called from the other databases. Is there a way in the utility functions to determine which database a function is being called from?
...
How can I rename a schema in SQL Server 2005?
...
Can we have a SQL query which will basically help in viewing table and index sizes in SQl Server.
How SQL server maintains memory usage for tables/indexes?
...
We used to have a search, that checks two columns for some words. Both columns must contain some words provided, so we use AND ... no doubts FULLTEXT INDEX is used on the columns.
The select is more or less like this:
SELECT
*
FROM SomeTable
WHERE (CONTAINS(Column1, 'word1 OR word2') AND CONTAINS(Column2, 'word3 OR word4'))
now ...
I have need to select a number of 'master' rows from a table, also returning for each result a number of detail rows from another table. What is a good way of achieving this without multiple queries (one for the master rows and one per result to get the detail rows).
For example, with a database structure like below:
MasterTable:
-...
I have a bunch of rows in Excel that I want to paste into a new table in MS SQL. Is there a simple way ?
...
How can we get information regarding poorly performing sqls(taking too much time for execution)
Does MS SQL server maintains tables/views (Similar to v$sql in Oracle) for storing sql queries.
...
How would you get tree-structured data from a database with the best performance? For example, say you have a folder-hierarchy in a database. Where the folder-database-row has ID, Name and ParentID columns.
Would you use a special algorithm to get all the data at once, minimizing the amount of database-calls and process it in code?
Or ...
I'm creating a stored procedure to return search results where some of the parameters are optional.
I want an "if statement" in my where clause but can't get it working. The where clause should filter by only the non-null parameters.
Here's the sp
ALTER PROCEDURE spVillaGet
-- Add the parameters for the stored procedure here
@accomod...
Hello,
I have a table with almost 800,000 records and I am currently using dynamic sql to generate the query on the back end. The front end is a search page which takes about 20 parameters and depending on if a parameter was chosen, it adds an " AND ..." to the base query. I'm curious as to if dynamic sql is the right way to go ( does...
When using the CHECKSUM column type to artificially create a hash index, is the lookup actually O(1) or is it still O(lg n) like it is for a clustered index? I have a table from which I will select based on its ID column and I need the lookup to be as fast as possible, so is the clustered index the fastest possible option? I am looking f...
I am doing a join on two tables. One is a user's table, and the other a list of premium users. I need to have the premium members show up first in my query. However, just because they are in the premium user table doesn't mean they are still a premium member - there is an IsActive field that also needs to be checked.
So basically I need...
I have a couple of tables which are used to log user activity for an application. The tables looks something like this (pseudo code from memory, may not be syntactically correct):
create table activity (
sessionid uniqueidentifier not null,
created smalldatetime not null default getutcdate()
);
create table activity_details (
ses...
I was trying the ASP.NET login control tutorial and everything works well. However, I do not know how to have the Log-in control use my own database (SQL Server 2005) instead of using it's mdf file. I also have no idea where this file was created from since it doesn't show up at all on my solution. Any literature that I can find on the w...
I have a database that hold's a user's optional profile. In the profile I have strings, char (for M or F) and ints.
I ran into an issue where I try to put the sex of the user into the property of my Profile object, and the application crashes because it doesn't know how to handle a returned null value.
I've tried casting the data to th...