sql

NHibernate CreateCriteria query problem

I hope someone can help with this please. I am trying to query an OLAP Fact table with NHibernate, but am struggling to get it to work. Its seems a simple requirement but I just cant see what the problem could be. I have a central Fact table with several Dimension tables, one of the Dimensions has a secondary Dimension. So ERD is. Fa...

Save binary to sql

Hello, I'm trying to convert a pdf to binary dato and saving it to my SQL database. When i just output the pdf (from binary) to the user, it works perfectly. The field in my database for the binary data is image. Here is what i'm doing atm: Set oFileStream = Server.CreateObject("ADODB.Stream") oFileStream.Open oFileStream.Type = 1 'B...

Which generation of languages does SQL belong to?

Is SQL classified as a fourth generation language or as a fifth generation language? ...

Automatically create scripts for all SQL Server Jobs

Currently I'm trying to automatically generate a create script for all my SQL jobs of a MS SQL2005 Server. One method I found was done manually http://msdn.microsoft.com/en-us/library/ms191450.aspx A second method I found could be done automatically but I don't have direct access to the SQL server. http://relatedterms.com/thread/19166...

How to retrieve the status of Foreign Key constraint?

I have the SQL query for getting all the constraint names, but not sure how to get its status like whether it is enabled/disabled? SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint, SCHEMA_NAME(schema_id) AS SchemaName, OBJECT_NAME(parent_object_id) AS TableName, type_desc AS ConstraintType,* FROM sys.objects Any help? ...

t-sql, sql table inner join spreadsheet

Hi all, I have a table (AmenityData) of data and a column of this table contains postalsectors e.g. E14 7 I also have an Excel spreadsheet with a list of postal districts e.g. E14 I need to get all the data out of the AmenityData table where the postal districts are LIKE the postal sectors e.g. WHERE [PostalDistricts] + '%' LIKE [Post...

SQL : The influence of research speed with empty clolumns?

Hi, I'd like to know if some empty columns (with the field 'null' for example) can decrease the speed to make a query "SELECT" on a indexed column or a normal column. Thanks, Ba ...

Slow simple update query on Postgresql database with 3 million rows

Hello, I am trying a simple UPDATE table SET column1 = 0 on a table with ~3 million rows on Postegres 8.4 but it is taking forever to finish. It has been running for more than 10 min. now in my last attempt. Before, I tried to run a VACUUM and ANALYZE commands on that table and I also tried to create some indexes (although I doubt thi...

Can alias in SQL be used within the same table?

i have a difficuly in understanding alias .... ...

select name of a person with at most grandchildren

Hi I have a simple table with persons, but there is a additional field witch holds information (person id) who is a father/mother of that person, so the 2 dimensional table can hold a familly tree the table is id first_name last_name salary spouse_id father_id mother_id sex 100 Steven King 26400 101 (null) (null) m 101 Neena Koc...

How to convert this TSQLcode to PostgreSQL /pgsql

Hi, ne need to convert the following tsql function code into a pgsql function and I have absolutely no idea how: BEGIN DECLARE @StartDate DATETIME DECLARE @ResultDate DATETIME SET @StartDate = CONVERT(DATETIME, 0) SET @ResultDate = CASE @Type WHEN 0 THEN DATEADD(mi, FLOOR(DATEDIFF(mi, @StartDate, @Date) / CAST(@Interva...

Find the length of the longest row in a column in oracle.

Hi, Does anybody know if there is a way to find what the length of the longest row in a column in Oracle? Basically I need to get the length of the longest row and then use that length plus 1 with SUBSTR to make the output of the column one character longer than the longest string. Thanks EDIT: Thanks for the advice. However, the MA...

How to copy data from one column to other column

Hi all... I want to copy data from one column to another column of other table..so how i should i do that.. i did following thing Update tblindiantime Set CountryName =(Select contacts.BusinessCountry From contacts) but its not working.. i want to copy "BusinessCountry" column of contact table to "CountryName" column of tblindiantim...

Get my database under Version Control using a DVCS [Mercurial]

What would be the best approach for versioning my whole database ? Creating a file for each database object (table,view,procedsure..) or rather having one file for all DDL scripts and any new change will be put in a separate file ? What about handling changes made in a Database manager tool ? I'd like to have a generic solutions for ...

error while executing Update query in the asp.net

I have used a class in which i have this update query for Payment Fees of a student whose Unique ID is UID and an Account ID is used for him i.e. AccId public string updatePays(string UID,int AccId,float hostel,float book,float exam,float reval,float studentDevelop,float misc,float reregistration,float late,float dues,float arrear,float...

What is SELF JOIN and when would you use it?

Possible Duplicate: sql: self-joins explained What is self join and when would you use it? I still don't understand self joins so a Layman explanation with a example would be great. Thank you in advance;-) ...

SQL Server: row present in one query, missing in another

Ok so I think I must be misunderstanding something about SQL queries. This is a pretty wordy question, so thanks for taking the time to read it (my problem is right at the end, everything else is just context). I am writing an accounting system that works on the double-entry principal -- money always moves between accounts, a transacti...

SQl Server 2005: Rows to columns -- how to do this challenge?

Please let me know, How to convert the following data , [id] cost1 cost2 year 1 5 10 2010 1 4 15 2011 2 10 10 2010 into this format [rows of 'Year' to columns heading] id [cost1-2010] [cost2-2010] [cost1-2011] [cost2-2011] 1 5 10 4 15 2 ...

Is there a reason MySQL doesn't support FULL OUTER JOINS?

Is there a reason MySQL doesn't support FULL OUTER JOINS? I've tried full outer join syntax in mysql many times and it never worked, just found out its not supported by mysql so just curious as to why? Thank you inadvance;-) ...

Standard script database variables (Oracle vs Sql Server Terminology)

What are the differences/equivalences between Microsoft Sql and Oracle connection parameters, and are there some common names they map to? Things like "database", "instance", "username", "tablespace". From Help me put Oracle terminology into SQL Server terminology we get: | Oracle | Sql Server | Universal| ==================...