sql

delete a record

Before I get into my question let me give you a little background on me first. I am a ASP programmer and I know enough about SQL Server (user side) to manipulate records to check my screens. As the title suggests, I am not able to delete a record from an sql table and I was able to about 2 months ago. About 6 months ago the DBA had t...

Simple JCR_SQL2 query returns nothing on Jackrabbit 2.1.1

Hi, I have this simple JCR_SQL2 query: SELECT * FROM [my:type] I'm running it like so: final QueryManager qMan = session.getWorkspace().getQueryManager(); final Query q = qMan.createQuery("SELECT * FROM [my:type]", Query.JCR_SQL2); final QueryResult qResult = q.execute(); return qResult.getNodes(); on a workspace which is indexed (a...

Problem printing from ReportViewer control in ASP.NET web application

I have a web application that utilizes the ReportViewer control in ASP.NET. The reports are defined in the web application, in .rdlc files. The reports work great, except for the printing functionality. When the user clicks the "print" icon in the header section of the report, it appears that the web app tries to install SQL Server (?!)...

Scripting execute permission along with stored procedure

In sql is it possible to script permissions as one can with the stored proc itself? So that I can simply tell somebody to hit execute and the proc and permissions just get created all at once. ...

Recursive SQL to Find Critical Path?

Given these two tables: [dbo].[Task] [Id] [Duration] [ScheduledStart] int int Nullable DateTime [dbo].[TaskDependencies] [Id] [PredecessorTaskId] [TaskId] int FK_Task_Id FK_Task_Id I'm trying to find the latest end date of the Tasks immediate predecessors. For the Task table, ScheduledStart is nullab...

How to document database efficiently (tables, attributes with definition)?

We have a fairly large database (in SQL Server 2008) with many tables. We have just bought Red Gate's SQL Doc for documentation purposes. We would like to document this database in a detailed way. What is the best practice in documenting a database? How do you document your attributes with definitions? SQL Doc documents the database nice...

How to add row number column base on duplicated records that currently ordered

Hi, I want to insert a page_number in a record that continuously count base on duplicate in a column. example output: ID PAGE_ORDER PAGE_NUMBER 1 7 1 2 7 1 3 7 1 4 7 1 5 7 1 6 10 2 7 10 2...

Find Non-Ascii Characters in One Varchar Column or Mulitiple Columns using SQL Server

How can rows with Non-Ascii Characters be returned using SQL Server? If you can show how to do it for one column would be great. I am doing something like this now but it is not working select * from Staging.APARMRE1 AS ar where ar.Line like '%[^!-~ ]%' For extra credit, if it can span ALL VARCHAR columns in a Table would be outst...

How to create an index for Wildcard search on an Int Column in SQL Server ?

I've got a table with millions of rows. The PK of that table is an Int column. User wants to be able to do wildcard search on rows of that table by that PK. When doing this query the trivial way, it will be horribly slow, as Sql server does an implicit conversion of the column value from int to char in order to apply the wildcard every s...

Best free library in .NET to handle data in SQL Server ?

What is the best free library in .NET to : select, insert, update data in SQL Server with best performance (low level) launch stored procedure generate automatically object layer (1 object = 1 table) without relationnal link (foreign key is only id - 'int') I don't want to use EF (very bad performance) Thank you ...

How to update one table from another one without specifying column names?

I have two tables with identical structure and VERY LARGE number of fields (about 1000). I need to perform 2 operations 1) Insert from the second table all rows into the fist. Example: INSERT INTO [1607348182] SELECT * FROM _tmp_1607348182; 2) Update the first table from the second table but for update i can't found proper sql synt...

Problem: we need to install SQL 2008 R2 Express with Management tools on about 24 physical machines of various OS flavors.

Problem: we need to install SQL 2008 R2 Express with Management tools on about 24 physical machines of various OS flavors. ...

Any alternatives to key word 'or' in an sql statement??

I probably didn't word the question right buy I have a query that is taking a substantial amount of time because of 'or'. select stuff from table1 T1 left join table2 T2 on T2.field1 = T1.field or T2.field2 = T1.field where some condition I have to check both fields to join. Is there a better way to do this? ...

Select that finds IF multiple

I am doing a inner join between two tables where one is an association table, so there is a many to one relationship. I am trying to come up with a query that can decide if the key on the join exist more than once than store a value multiple in the update column, but not sure the efficient way to make this happen: SELECT MainTable.Na...

Using sqlchemy in Pyqt, is it possible?

Hi i am new to Pyqt and i am wondering if it is possible to have goodness of sqlalchemy e.g. connection pooling and managing, abstracting away all the menial low level details? ...

Postgres injection tools

Hi all, I am looking for tools that I can use to audit the security of my database at the moment. Does anyone have any resources on this? I am running postgres, so that will take precedence. ...

how do I get update notification from server to client?

Hi I am doing a task using socket programming,in this I have database on server side and whenver any employee update any table ,server should notify all employee by triggring pop up on employee pc.my question is how to get any update from server and how to trigger pop up on server notifivation.plz help me. ...

What is the MS SQL Server capability similar to the MySQL FIELD() function?

MySQL provides a string function named FIELD() which accepts a variable number of arguments. The return value is the location of the first argument in the list of the remaining ones. In other words: FIELD('d', 'a', 'b', 'c', 'd', 'e', 'f') would return 4 since 'd' is the fourth argument following the first. This function provides t...

Simple INNER JOIN Query Returns No Value - Where Did i Go Wrong?

The query below fetches the wageTypeID based on the current active hiring info record and salary record. SELECT wt.wageTypeID FROM TimeSheet t INNER JOIN Employee e ON e.employeeID = t.employeeID INNER JOIN Salary s ON s.salaryID = t.salaryID INNER JOIN Wage w ON w.wageID = s.wageID INNER JOIN EmpHiringInfo ehf ON ehf.Emp...

Which gives a faster query? Which is cleaner? JOIN ON or WHERE

When should I be using JOIN ON or WHERE in a scenario like the one below? DECLARE @PhoneNumber int = 5551234 -- JOIN ON SELECT * FROM Persons JOIN Employees ON Persons.DateOfBirth = Employee.DateOfBirth AND Persons.PhoneNumber = Employees.PhoneNumber WHERE Persons.PhoneNumber = @PhoneNumber -- WHERE SELECT * FROM Persons JOIN Employ...