Database: MS SQL 2005
Table:
EmployeeNumber | EntryDate | Status
Sample Data:
200 | 3/1/2009 | P
200 | 3/2/2009 | A
200 | 3/3/2009 | A
201 | 3/1/2009 | A
201 | 3/2/2009 | P
Where P is present, A is absent.
I have tried row_number over partion. But it does not generate the sequence which I expect.
For the above data the sequence...
I have a typical table of hierarchical data in id, parentId form.
CREATE TABLE Hierarchy (Id int, ParentId int NULL, Name varchar(128));
INSERT INTO Hierarchy VALUES (1, NULL, '1');
INSERT INTO Hierarchy VALUES (2, NULL, '2');
INSERT INTO Hierarchy VALUES (3, NULL, '3');
INSERT INTO Hierarchy VALUES (4, 1, '1.1');
INSERT INTO Hierarchy ...
I'm new to ASP.NET but not to programming. I am migrating our current site from PHP/MySQL to ASP.NET(3.5)/SqlServer. I've been lurking here since the site's launch, so I'm confident that one (or more) of you can help me out. Here's the scenario:
This is a training department site and the dept. has a course catalog stored in the table co...
how do you create a new database user with password in sql server 2005?
i will need this user/password to use in the connection string eg:
uid=user;pwd=password;
...
Hi,
I am stuck with something really nasty here. I have a SSAS Cube that was working fine till day before yesterday. Had some performance issues on the server and got cummulative patch 938077 on top of Service Pack2.
Since then I have not been able to deploy the cube - with a strange error -
File System Error: The following error occu...
What are the differences between MySQL and Sql server?
What are the parameter to chose between the two?
...
I have a query
select * into NewTab from OpenQuery(rmtServer, 'select c1, c2 from rmtTab')
When I look at the execution plan, it tells me that it performs a 'Table Spool/Eager Spool' that 'stores the data in a temporary table to optimize rewinds'
Now I don't anticipate any rewinds. If there is a crash of some sort, I can just drop ...
I have an asp.net website on a server and the db MS SQL 2005 on another server, the last few days the website show me this error message:
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that S...
I'm trying to add a content database to my MOSS 2007 site, but I can't seem to connect to the SQL Server. I run the following from the command prompt:
stsadm -o addcontentdb -url htt://testserver:101 -databasename WSS_ Content_MySite -databaseserver SHAREPOINT01
STASADM gives me this error: "An error occured while establishing a conne...
Hi
Is it better to create lots of SQL statements or to cache the data in asp .NET and manipulate the data from there?
cheers
...
The title says it all. I just setup a new Windows Server 2008 machine with an instance of SQL Server 2008 Express. The SQL Browser service does not appear to be working correctly. In Management Studio, browsing for servers shows the hostname of the new server, but not the instance name. When you choose the hostname form the list it d...
I was wondering if you can do bitwise operations on an int/uint fields in SQL SERVER?
...
The MSDN docs weren't entirely clear on this one. or perhaps I'm not reading them well enough.
If I do an insert (which may insert zero rows), followed by
;SELECT SCOPE_IDENTITY()
And then call the command by ExecuteScalar()...
What will the result be if the Insert doesn't insert any rows?
I want to stop if it fails so that I don'...
Hi folks,
I've got a web application that uses Microsoft Sql Management Objects (SMO) dll's. I'm wondering how I go about redistributing the libraries for a remote machine.
As I understand it, these come with SQL server or Sql express - which isn't on the remote (shared) webserver. Asking the host to install them, is probably out of t...
What is the best way to get stored procedure useage data on a specific database out of SQL Server 2000?
The data I need is:
Total of all stored procedure calls over X time
Total of each specific stored procedure call over X time.
Total time spent processing all stored procedures over X time.
Total time spent processing specific stored...
I have a vague recollection of hearing about a profiling tool that could sit and watch the SQL Server that is serving data to my production website. In particular, I'm looking for a tool that can, based on profiling what is actually taking the most time, do things like make suggestions for new indexes or other sorts of simple optimizati...
I have the following XML:
<Field FieldRowId="1000">
<Items>
<Item Name="CODE"/>
<Item Name="DATE"/>
</Items>
</Field>
I need to get the FieldRowId using OPENXML. The SQL i have so far:
INSERT INTO @tmpField
([name], [fieldRowId])
SELECT [Name], --Need to get row id of the parent node
FROM OPENXML (@idoc...
How do I get this batch of SQL to get to the RollBack Transaction part at the end? SQL just stops halts script execution on the bad line of code. I know I can use a try/catch construct but i'm more interested in how this was this handled before SQL added try/catch.
BEGIN TRAN
CREATE TABLE TempTable (c1 INT NULL)
INSERT INTO TempTable ...
We're currently attempting to implement a sql server 2008 udf to do expansion of shortened urls. We have it working quite well against most of the major url shortening services. However, at seemingly random times it will "hang" and refuse to work against a certain domain (for example bit.ly) while subsequent calls to other services...
In which pratical scenarion would you prefeer one or the other?
I know there are a lot of parameter you can compare, can you give me some practical examples?
Example: mysql in case of multiple databases with few tables, sql server for single database with lots of tables because....
...