sql-server

Need help to write bat file that execute sql scripts in (sql server 2008 and another 3 files.?

Hi all I am sure these has been asked before but cannot find clear instruction how to create a batch file lets call it "Update Database" this batch file should Execute sql scripts located in different folders Execute another 3 bat files. Any quick examples how to do it?Never done it before thanks a lot EDITED Can I do this? :On ...

ASP.net, C# Page load on lightbox close issue

I want to know what exact events fires when ASP.NET page load event fires. As i am using a lightbox in which some insertion is going on and after insertion i want that the parent page reloads with the new value loaded in gridview which i have in parent page. In light box page i added javascript event of parent window reload but sometime ...

SQL Server Cell Level Encryption

Hi I want to implement cell level encryption and only users with my ODBC will be able to connect to database and use it. What do you suggest about it? Is it possible? If yes, any resource, source code, samples, documentations on it? If it's not possible, please tell me why. Thank you! Kind Regards ...

Errors: "INSERT EXEC statement cannot be nested." and "Cannot use the ROLLBACK statement within an INSERT-EXEC statement." How to solve this?

I have three stored procedures Sp1, Sp2 and Sp3. The first one (Sp1) will execute the second one (Sp2) and save returned data into @tempTB1 and the second one will execute the third one (Sp3) and save data into @tempTB2. If I execute the Sp2 it will work and it will return me all my data from the Sp3, but the problem is in the Sp1, whe...

equivalent of rowlock xlock holdlock (sql server) for postgres

in sql server begin tran select * from foos with (rowlock, xlock, holdlock) where id =7 ... commit tran will lock the row for reading and writing and it will hold the lock until the end of the transaction, is there an equivalent of this in postgresql ? ...

SQL Server Query monthly totals

I have a query that totals up all cases that were active on 01/01/2010. SELECT COUNT(CaseID) AS Total FROM dbo.ClientCase WHERE (CaseStartDate <= CONVERT(DATETIME, '2010-01-01 00:00:00', 102)) AND (CaseClosedDate >= CONVERT(DATETIME, '2010-01-01 00:00:00', 102)) OR (CaseClosedDate IS NULL) GROUP BY CaseStartDate I also...

SQL To Get Parent From Self Referencing Table

I have a table like this: Item { int ItemID int ParentID string Name } Item is actually a subset of a larger table Object: Object { int ObjectID string Color } So ItemID is an FK to ObjectID. Within Item, ParentID can either refer to another Item or to the parent Object. What I'd like to do is be able to iterate...

SSRS 2008 wordwrapping issues

hi, i am using SSRS 2008 and currently I am facing wordwrapping issues. In report I am placing a table and some 6 columns. My report size is A4 landscape. When running the report,one of the column has a large value without any spaces,the column was not wrapping up,so I changed the layout to A3 landscape and the wrapping started worki...

SQL Server: Why xp_cmdshell is disabled by default?

What are the security reasons that extended stored procedure xp_cmdshell is disabled by default? ...

Duplicate SQL Server database on same server cannot be accessed

I am using SQL Server Workgroup Edition on Windows Server 2003 R2 My classic ASP pages access my production database using a system DSN. All working here. Code like this... <% dbName= "ProdDB" userID = "PublicUser" pwd = "PublicUserPW" Set objConn = Server.createObject("ADODB.Connection") objConn.connectionString = "DSN=MySyste...

Best tool to document T-SQL *source* files?

Hi. At work, the database is not documented at all. Furthermore, the stored procedures, functions and views are all encrypted, this rules out a lot of tools that document these objects for you. All I have are the plain .SQL files that generate the database, schemas, tables, functions and all. I'd like to know, is there a tool that can r...

What are best practices for database setup from a winform client

I have written a winform application that connects to a database on our corporate network. I created the database as I was writing the application. Now it’s time to document the schema and to provide a method of recreation in the event that it is lost for what ever reason. I have been considering that the client application should ask t...

ASP.NET Session Performance

I'm experiencing performance issues on my asp.net application. Sometimes it would take the client 30-40 seconds to execute a command, where as in sometimes it would take 3-4 seconds. I tried SQL Profiler and I don't see any problems. I was not able to replicate the issue on my side, under the same scenario when the client was trying. I...

How to use transactions (begin transaction, commit transaction)?

I have seen transaction usage in some cases but never really understood in which situations they should be used. How and when transactions should be used (begin transaction statement)? I have read that Microsoft do not suggest to use transaction statements (commit, rollback) inside a trigger and stored procedure. ...

Should I use sp_executesql or EXEC to run a stored procedure?

I have a stored procedure that needs to call a 2nd SP multiple times. The only thing that changes are the parameters to the 2nd SP. Something like this: SELECT @P1=5, @P2=5 EXEC MyProc @P1, @P2 SELECT @P1=0, @P2=1 EXEC MyProc @P1, @P2 Now if it was dynamic SQL I was running I know sp_executesql would be better than EXEC but since...

Random Questions using DetailsView (Help)

Greetings everyone, i would just like to ask how do i retrieve data rows in my table in my database randomly... i was able to create an online quiz wherein it displays the question,choices in consecutive order but what i want is, every time when user will start a quiz it will show questions in random order. I am using mssql 2005 as my d...

java sql connectivity

I have created a user dsn named "harshi" To insert rows in a table getting data from Java code I want to insert in SQL table. The connection statement is: String url = "jdbc:odbc:Harshi"; Connection conn = DriverManager.getConnection(url,"",""); Statement st = conn.createStatement(); Still I am getting output as: Got an excepti...

UNIQUE argument for INDEX creation - what's for?

Why does INDEX creation statement have UNIQUE argument? As I understand, the non-clustered index contains a bookmark, a pointer to a row, which should be unique to distinguish even non-unique rows, so insuring non-clustered index to be unique ? Correct? So, do I understand that no-unique index can be only on clustered table? since ...

How to store a list of items on a single column in SQL Server 2008

I am looking for an efficient way to store users' information in a SQL Server 2008 table. In the design all users data will be stored in a series of columns in a single table but one of the columns requires to store a list of values, for example: 'column1' will store the username, 'column2' will store the userID and 'column3' will store...

How can I rewrite this MS SQL Script as a MySQL Script?

I'm trying to work my way through a Java Tutorial. The author wrote the tutorial to work with MS SQL. I'd like to follow the tutorial using MySQL. I'm not completely sure how to translate the MS SQL script which uses "IDENTITY", "CONSTRAINT", and "CLUSTERED" as you'll see below: CREATE TABLE [event_person] ( [event_id] [int] NOT NU...