sql

Detect last login date/time in SQL Server 2000

Is there a way of determining when a given user last logged into SQL Server? We are about to carry out an audit of our database server and would like to delete users that are redundant. Incidentally I'm interested in users at the server-level (i.e. Logins), not users of individual databases. Thanks in advance. ...

What's the decimal separator in a MySql INT field?

Is this set somehow in a variable? Is it possible to store decimal values in INT fields or does it have to be FLOAT? Comma or point as a separator? Or does it even matter? Thanks ...

SQL: Counting number of matching results when using a LIMIT query

Say the users table in my MySQL DB contains a very large number of entries. I need to go through all the users, but I want to do it only chunks at a time (i.e. using LIMIT and OFFSET): SELECT * FROM users LIMIT 100 OFFSET 200 Is it possible to know the total number of users matched in the query, but only return a LIMIT number of them ...

How can I store sql statements in an oracle table?

We need to store a select statement in a table select * from table where col = 'col' But the single quotes messes the insert statement up. Is it possible to do this somehow? ...

SQL - How to ALTER COLUMN on a computed column

I'm working with SQL Server 2008. Is it possible to alter a computed column without actually dropping the column and then adding it again (which I can get to work)? For example, I have this table: CREATE TABLE [dbo].[Prices]( [Price] [numeric](8,3) NOT NULL, [AdjPrice] AS [Price] / [AdjFactor], [AdjFactor] [numeric](8,3) NOT NULL) La...

Display contents of TSQL view

I have a view which if i try to edit, MS SQL Server Management Studio crashes (the view contains a pivot function). Is there a way i can view the sql that is inside the view without crashing MS SQL Server Management Studio? ...

Complex SQL query for ShoppingCart

I've been trying to figure out how to query a shopping cart database to find all Orders that contain tangible items (items can be downloadable, therefore, not shipped) that have not been assigned a UPS tracking label. I haven't been able to do it. The involved tables are as follows: // dbo.Inventory - details about the individual produ...

SQL server: How to check database has catalog or not

I am trying to find out whether a database has a catalog or not. I couldn’t find any system stored procedure to perform this task. I need to find the catalog first then perform Full text search. If a catalog is not found, full text search is ignored. ...

Does the sequence in which we use join in a query effects its execution time ?

Does the sequence in which we use join in a query effects its execution time ? ...

Reporting Services running on SQL Server 2008 Express

I know I can run Reporting Services on SQL Server Express w/ Advanced Services. The articles I have read do not touch on my question. I'm wondering, in this scenario, can remote users execute reports from the report server remotely using URL access ex:)http://mySQLExpressBox/ReportServer/rptMyReport....... etc - Or will reports only...

Is it possible to "measure" the usage (e.g. in MBs) per user, of an SQL Server database in web farm conditions?

I have an ASP.NET web application hosted in a web-farm environment, and I need a way to be able to indicate how much a user is using my database. There are several reasons for this, and I mention a couple. First, because I pay for the database space per month, I want to have a reasonable way to charge my users. Second, it would be nice...

Best pratice to populate data in a template?

I am wondering what solutions out there for populating data for a template. Right now we store email templates in the datatabse with place holders in them. When we need to send out the emails, we would replace the actual value in for the place holder. This solution works, except it is very hard to debug. Thanks in advance. Angela ...

ordering by total number of rows

Here is my scenario, "movies" table on the mysql database, director_id movie ----------- ------ 1 movie1 1 movie2 1 movie3 3 movie4 3 movie5 2 movie6 2 movie7 2 movie8 2 movie9 how can i order ...

SQL Server Reporting Services: web references vs assembly references, poor performance

I am using Reporting Services to render a report directly to PDF. It requires that I use two web references: ReportExecution2005.asmx and ReportService2005.asmx. The performance on web references seems really poor. Since my web server (IIS7) and my SQL Server (2008) are on the same box, is there a way I can reference them directly? If no...

SQL Update hangs Java program

Hello I'm writing a combination Java/Perl program that parses XML files into an Oracle SQL database. There are two tables in the database - one that holds the data from the XML files and another that holds information about the files themselves (file name, creation time, etc.). Basically, when a new XML file comes along, the Java progra...

Fast way to determine if an field exist in a ORACLE table

I am looking for a fast sql sentence for determine when a field exist or not in a table . actually i am using this sentence Select 1 from dual where exists (select 1 from all_tab_columns where table_name = 'MYTABLE' and column_name = 'MYCOLUMN') I think there must be...

How to cast to string the result of an inner query?

I have the following query (which should return a scalar/numeric), But I still get a sql error. I am using mysql 5.0.77 or 5.1.37 SELECT CAST(SELECT COUNT(*) FROM t1 AS VARCHAR) ...

List all tables in postgresql information_schema

What is the best way to list all of the tables within PostgreSQL's information_schema? To clarify: I am working with an empty DB (I have not added any of my own tables), but I want to see every table in the information_schema structure. ...

Data Access Application Framework for .NET + SQL Server?

We are looking to create an in-house Project Dashboard application. Project Managers will use this to create and update projects, submit project status, enter project metrics, etc. A separate reporting piece would read the data entered by the tool and bubble up reporting data. If this were 1990 and the app was to run in DOS I would ch...

Limiting Results on Join Query

Say I have the following tables: |RefNumber| Charge| IssueDate| ------------------------------ | 00001| 40.0|2009-01-01| | 00002| 40.0|2009-06-21| |ID|RefNumber|Forename| Surname| --------------------------------- 1| 00001| Joe| Blogs| 2| 00001| David| Jones| 3| 00002| John| Smith| 4...