sql

SQL Server can't store more then 4000 characters in a local string variable

I tried to use text or ntext as the variable's type but they are disallowed. Is there a way to bypass this? ...

Solr returns 'oldest' records instead of 'newest'; 'Rows' and 'Start' parameters

How come Solr returns the "Oldest" records first when specifying these parameters. As you probably know these are mainly for "paging" purposes. And if I chose something like 10 Rows per page, and with the start set to 0, this means in my mind that the latest 10 records should be displayed. However, Solr displays the oldest 10 records. ...

What SQL ORM may i use to replace this old code

Sorry since this question is specific to my problem. While learning reflections i did a mini SQL ORM in a week then minor tweaks while using it for another week. Since it has very little work put into it, its really only compatibility with sqlite. I havent had problems with the code so far but i would like to port it to something that s...

Hibernate update issue

Hi! I have a strange Hibernate behaviour in my program. I have two classes with onetomany relation: good and price: @Entity @Table(name="GOODS") public class Good { .... @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER) @JoinColumn(name="GOOD_ID") private Set<Price> prices = new HashSet<Price>(); ...

MySql 'Select' help

I have some tables. These tables all have one column in common called 'classified_id': main_table: cars_table: id (PK) => 4222 id (PK) => 1021 classified_id => 25 classified_id => 25 Now, I want whenever a search is performed, to compare if any of the main_table.classified_id mat...

Merge ASP Membership users and tbUsers from DataBase Win Application on sql

Hello. I've got a real trouble now. I've got my win Application and a lot of functionality with TbUser table. It's simple table with ID , Username and Password , and some nullable fields And now I need to merge it with my ASP.NET Membership table :S __Finally I need to register users in my WinApplication ! And login into ASP.NET web ...

sqlcmd: how to supress hyphens

How can I supress hyphens (------------) from the results set of this sqlcmd-command: C:\temp>sqlcmd -d AdventureWorks -s ";" -Q "SET NOCOUNT ON SELECT top 5 FirstName, LastName FROM Person.Contact;" FirstName ;LastName --------------------------------------------------;--------------------------...

Group Specific set of data by Day

Need to get a certain subgroup of data per day (Separated by weekday) For example Select weekday,bla,blabla,blablabla from dbo.blabla where bla = @StartDate and bla <=@endDate I need the output to be: Monday bla blabla blablabla Tuesday bla blabla blablabla If someone could help me that would be awesome. Thanks & Regards Jacques ...

SQL database design

I am making a database for a program where i am supposed to model some relations in the family. ex: X is father to Y , Y is son to X So , i have a Members table with all info about each member so i thought about making a many to many relation between the Members table and itself so that the Member_Member bridge table will be having the ...

Error in sql query - Operation must use an updateable query

when i give this sql query in my msaccess database table called warehouse1 it gives this error "operation must use an updateable query?" UPDATE warehouse1 SET STD_MOU = "?" WHERE warehouse1.[STD_MOU]="null"; what could be the reason ? ...

insert or update if record is in table

I have a tables Cars and CarDescriptions cars: IDCar(int, PK, autoincrement) carsDesciptions(IDDescription, Header(nvarchar),Content(nvarchar),idCar(int,FK) In application I am adding cars and editing existing ones. My problems: 1.How to save changed Car with descriptions in database ?? I have ID of Car, and I have ID's of D...

MS Access - SQL exclude data query

Original question was unclear, so attempting to simplify and rephrase. In MS Access I have a Query that is supposed to find all records which: Have a PhaseID (entered by user) of X, for simplicity take 3. Only show the records where the priority field is set to greater or equal then 2. Below is the query shown that is currently in e...

Web Payment Idea for mysql 3.23 and asp.net

My company has an old windows program. Written in turbo delphi mysql-max-3.23.53-win with zeos components. We need an web payment system integration for this. I have tried with visual studio 2008 and mysql connector, but the connector gives error to connect this database. we can not upgrade the mysql version because there is a lot of cod...

Which Oracle table uses a sequence?

Having a sequence, I need to find out which table.column gets its values. As far as I know, Oracle doesn't keep track of this relationship. So, looking up for the sequence in source code would be the only way. Is that right? Anyone knows of some way to find out this sequence-table relationship? ...

SQL request with "Group by" and "max" and "join" ?

Here is a sample of my DATA: CLIENT_ATTRIBUT : ID_CLIENT | DATE_CLIENT | ATTRIBUT ----------+-------------+--------- 000000001 | 2010:03:01 | 0000010 ----------+-------------+--------- 000000001 | 2010:02:16 | 0000010 ----------+-------------+--------- 000000001 | 2010:03:04 | 0000011 ----------+-------------+--------- 000000002 | 2...

Is it possible that we pass a query to PIVOT as column list in SQL Server?

As you know the PIVOT syntax is like below : FROM table_source PIVOT ( aggregate_function ( value_column ) FOR pivot_column IN ( <column_list>) ) table_alias I want to know is it possible that we pass a query as <column_list> to PIVOT? In action, I want to write FOR DepartmentName IN (SELECT Name From Department)) instead of ...

Best approach for script to download thousands of files in C#, SQL 2008

I have a script which runs through a database table and downloads a file for each row, adds to a results table in memory, then bulk uploads all the results back to the database once finished. The problem I have is that there could be thousands of files to download and the script could timeout or error half way through. Is there a bet...

SQL select multiple rows from foreign table for multiple columns

In our PostgreSQL db, we have a table called 'tokens': token_id | file_cc | file_cc2 | file_cc3 | file_ob All the columns prefixed with 'file_' contain id's to the 'files' table: file_id | name | location | hash What I want is to select a token and to the resultset add the name and location from the files table for all the file col...

How do I back up SQL 2008 tables & stored procedures?

Last night I got completely hosed by a worm from Dilbert.com (so be careful there). It is invasive enough where I am going to do a complete system restore. The only thing I need to save on the pc is a database (consisting of just tables & stored procs) in SQL 2008. How can I export them so that, once I restore, I can easily import them a...

MySQL find count query

Hi, I have table called stats. In am inserting yes or no in the table, and I want to show the number of yes count and the number of no count. Can somebody please help me with the query? ...