SQL Pivot and formatting Grid
I used pivot to get data in format Store department Employee Q1 Q2 Q3 ---------------------------------------------------------- abc d1 u1 1 Null Null abc d1 u1 Null 3 Null abc d1 u1 Null Null 2 abc ...
I used pivot to get data in format Store department Employee Q1 Q2 Q3 ---------------------------------------------------------- abc d1 u1 1 Null Null abc d1 u1 Null 3 Null abc d1 u1 Null Null 2 abc ...
I'm new to T-SQL; all my experience is in a completely different database environment (Openedge). I've learned enough to write the procedure below -- but also enough to know that I don't know enough! This routine will have to go into a live environment soon, and it works, but I'm quite certain there are a number of c**k-ups and gotch...
I have been looking for a solutions for this problem for days now. I have a new server running server 2003 and sql server 2005. When I turn on allow remote connections using tcp or any other options and restart the sql service, the service will not start. If I turn off allow remote connections I can then start the sql service with no pro...
I am working with a half dozen DBs. The DBs all have the same schemas, the same SPs, etc. Speaking to the person who originally designed the DBs, a big part of the motivation for using many DBs was efficiency; the alternative would be to add a column to pretty much every table and sp in the database indicating which set of data was bei...
We are having some connectivity issues from a client application connecting to a remote SQL Server 2005 (named instance). What are some ways to test connectivity from the client machine (Windows XP) that doesn't have SSMS or Query analyzer installed? I would like to see if the issue is related to the specific application or is it a mor...
I'm using ODBC and C++ against SQL Server 2005 (native client). I have the following simple test stored procedure that returns two rows of constant values: CREATE PROCEDURE usp_testme AS BEGIN declare @details table( one int, two int, three int, four int ) insert @details SELECT 1 one, 2 two, 3 three, 4 four UNION SELECT 5, ...
Hey Guys :D For my final year project, I'm making what I call - SeeQuaL and it's a one stop interface for accessing 3 of the most famous database types - SQLite, SQL Server and MySql. I'm Pretty sure that I can get things done with the SQLite and MySql. But SQL Server, meh! will surely give me problems. Now lets take the case that I ha...
Is performance of DB slow in sql server 2005 express compared to sql server 2005 enterprise ? Comparison between sql-server 2005 and express 2005 is here Comparison between sql-server 2008 and express 2008 is here ...
I created a user on the SQL Server but using that login I get this message: Login failed for user ''. The user is not associated with a trusted SQL Server connection. [SqlException (0x80131904): Login failed for user ''. The user is not associated with a trusted SQL Server connection.] Here is my connect string: <connectionStrings> ...
I'm using DocX to create .docx files. Instead of storing them on hard drive, Share or SharePoint i would prefer to store them inside SQL Database. So my questions are: How to write proper code to save file to that database? How to write proper code to retrive file to that database? What kind of datatype should i set for a table to hol...
I'm running a query from SQL Server Management Studio 2005 that has an HTML file stored as a a string, e.g.: SELECT html FROM table This query displays in the "Results" window nicely, i.e., each row contains a string of the whole HTML file, with one record per row. However, when I use the "Results to file" option, it exports it a...
I already have sql server 2008 installed and now need to install 2005 express as well. When I try this, the installation fails with: "An installation package for the product Microsoft SQL Server VSS Writer cannot be found" - any ideas anyone? ...
An example of my tree table is: ([id] is an identity) [id], [parent_id], [path] 1, NULL, 1 2, 1, 1-2 3, 1, 1-3 4, 3, 1-3-4 My goal is to query quickly for multiple rows of this table and view the full path of the node from its root, through its superiors, down to itself. The ultimate question is, should I generate this path on inse...
how to get top n rows from a table where value of n is passed at run-time? Thanks in advance ...
I have a stored procedure query that I want to return the details of columns within a specific table. When I run the sp in Sql server managements studio I get results returned. The problem is when I try to execute the query from C# code. There are no exceptions thrown and the relevant persmissions are granted to execute the procedure ...
I would like to execute multiple statements on one line in SQL Server 2005. How do I do the following on a single line: use master go sp_spaceused mytable When I try use master; go; sp_spaceused mytable I get Incorrect syntax near 'go'. When I try use master go sp_spaceused mytable I get Incorrect syntax near 'go'. ...
I have two tables (TableA and TableB). create table TableA (A int null) create table TableB (B int null) insert into TableA (A) values (1) insert into TableB (B) values (2) I cant join them together but still I would like to show the result from them as one row. Now I can make select like this: select (select A from tableA) as...
I am getting the error from the application as following with SQL server 2005 "Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0" How can i find the stage where this error raised? how can i found the missing transaction or the stored...
How can I create a valid connection string by using shared memory protocol to connect a named instance of sql server while the sql server browser is disabled? ...
In my stored procedure, I would like to check to make sure what I am trying to insert doesn't already exist in the table. I have tried the code below, but it seems to be giving me false positives (aka comes out to true even when it's not in the table). Is there a better way? if not exists (select myID from tableName where myID = @myID a...