sql-server

when to copy Resource database and when system databases?

"The Resource database is a read-only database that contains all the system objects that are included with SQL Server" [1] This sounds that one database from one instance (which one?) contains all information on the whole SQL Server, though I observe that each instance has its own Resource database copy. Is this phrase "with SQL S...

Can a DBA find performance issues just from reading the TSQL code?

Can a DBA find performance issues just from reading TSQL code? Is a DBA expected to have that capability? ...

Can we rollback to original state after we have used DBCC CHECKIDENT to restart Identity column count ?

Currently on some operations I have to delete the old data and insert new one. But I noticed that inspite of deleting data the identity column did not reset and continued from its last max value. So i used the DBCC CheckIdent for achieve the same all this is taking place within a trasaction. Can i rollback the transaction back to the int...

Selecting multiple table values and binding the data into multiple grids

Hi Everybody. I have multiple tables . I have created one stored procedure where I am selecting the table values. like create proc myProc as select col1, col2, col3 from table1 select cola, colb, colc from table2 select colp, colq, colr from table3 select colx, coly, colz from table4 I am using ...

SQL Queries, execution plans and "Parallelism"

So I'm (still) going through some slow legacy sql views used to do calculate some averages and standarddeviations on a (sometimes) large set of data. What I end up with are views joining views joining views etc. So I though I would review the execution plan for my query. And it immediately suggested a missing index, which I then impleme...

How to force Sqlservices.Uninstall to delete old data too?

Hi all, Does I use SqlServices.Uninstall() to uninstall ASP.NET Membership tables and other stuff programmatically from database. But when tables hold old data, it does not work with following error message: Cannot uninstall the specified feature(s) because the SQL table 'aspnet_Membership' in the database '[DBNAME]' is not empty. You ...

How to insert data dynamically in different tables?

Hi, I created dynamic survey. i want to copy the same survey to another survey id. SurveyTable: SID SName Created Date QuestionTable QID Question SID AnswerOptionsTable AID Answer QID Now i created one survey for that i added questions and answers. But i want to copy the same survey with another SName so that remaining table ...

Perl -- DBI selectall_arrayref when querying getting Not Hash Reference

Hi I am very new to perl (but from a c# background) and I am trying to move some scripts to a windows box. Due to some modules not working easily with windows I have changed the way it connects to the DB. I have an sqlserver DB and I had a loop reading each row in a table, and then within this loop another query was sent to select diff...

UNION ALL, TEXT field and ORDER BY error

Hi, Im having two tables with attributes like date(datetime),headline(varchar),text(text) Now i want to UNION ALL these two tables and sort by the datetime. When doing this i'm getting the error: Only text pointers are allowed in work tables, never text, ntext, or image columns. The query processor produced a query plan that requir...

How to manage long execution time taken by the sp's in sql-server

We are using sp's to convert a uploaded file into corresponding master values and their combination as the business rule demands. For this we have made 4 sp's . All these sp's are called from a single sp which the user calls from application along with the data from the file. Note: Each sp must be called after the previous one has finis...

asynchronus triggers

Greetings I need to know what is the meaning of asynchronoous trigger and is there difference between asynchronus triggers and the normal triggers that is used in sql-server after or before inserting ,updating,deleting thnx ...

ODBC API to retrieve UserDefinedType of a Column in SQLServer 2005/2008

Hi, I have read that the ODBC API "SQLDescribeCol" could be used to retrieve the SQLDataType of a column. Similarly, is there any ODBC API which could be used to retrieve UserDefinedType of a column? -Vengatesh ...

Subtract two time values in ms sql server 2008

Hai all, How to subtract two time values in sql server 2008.I am using time variables in stored procedure. please help ...

How to query hierarchical information with SQL-Server 2000?

I've got a table Folders with hierarchical information about folders: FolderID FolderName ParentID 1 Folder1 0 2 Folder2 1 3 Folder3 2 4 Folder4 3 For Folder4 I would like to get the parent folders in the following format: Folder1\Folder2\Folder3\ Not...

how can we get data from xml file in sql server 2005 as described?

--- This is the content of the XML file or consider as XML variable. From above xml file , i want the data like .. id name desc parentid 1 serach Search NULL 2 Search By Name SearchName 1 3 Search By ID SearchID 1 How can we get with single SQL statement in SQL serv...

SQL-Server common problem - Retrieve ID just inserted

I've looked at some other questions, they seem to be unrelated to SQL-Server. Given the simple example query: INSERT INTO tblComments (comment, user) VALUES ('lol', 'Guest') Now suppose after the new user is created I need to insert some more data in other tables that require the last entered ID, I would do: SELECT TOP 1 ID FROM tbl...

Is there a MSSQL command to merge lots of rows data into a single row from a common key?

I have a few tables filled with info like this: jobDetails: +-----------+------+---------+ | JOBNUMBER | DATA | KEY | +-----------+------+---------+ | 6015425 | .... | COLOUR | +-----------+------+---------+ | 6015425 | .... | SIZE | +-----------+------+---------+ | 6015425 | .... | WEIGHT | +-----------+------+---------+...

Getting syntax error when trying to use OPENQUERY

I am trying to do a query via ODBC to our ERP database. The documentation guide suggests that we use OPENQUERY to send the query. Here is my example query SELECT Q.Part_No, Q.[Description], Q.Part_Type FROM OPENQUERY ( LINKEDSERVER, ' SELECT P.Part_No, P.[Description], P.Part_Type FROM LINKEDSERVER...Part_V_Part AS P WHE...

SQL Server transactions - whole db locked ?

Hi, I have a problem on specific SQL Server 2008 customer installation. I wrote the code below to simulate the problem which happens in more complex system. There are two connections (each one with own transaction) opened and each connection modifies a table. Modified tables do not relate to each other. On development platform and other ...

Login issues on shared SQLServer session state of web-farm

Per a question I posted yesterday, our website's DNS structure has changed to round-robin DNS which literally swaps back and and forth between two production servers. Our web.config for both prod servers has: <sessionState mode="SQLServer" ... > pointing to the same shared DB A machineKey on each server that is consistent between the t...