sql

SSIS Package Configuration

I have a package that loads data from a text file into a table but I am having trouble setting the package configurations. I was hoping that I could import my package to any database and that that package would automatically lookup the SSISConfigurations table on the database that package is installed on. The package seems to always look...

Ordering by posts in another table

Hello all. I have created a feature where users can start new topics (similar to forums). At the moment on a page, the query for the topics are as follows: $q = "SELECT ".TBL_COMMUNITYTHREADS.".title, ".TBL_COMMUNITYTHREADS.".id, ".TBL_COMMUNITYTHREADS.".date, ".TBL_COMMUNITYTHREADS.".author, ".TBL_USERS.".username FROM ".TBL_COMMU...

SQL ForeignKey Column

If i use a ForeignKey in SQL, does it always have to use all the column of the table I reference from? So eg. Table1 subjectID firstname surname email Table2: car books Foreignkey(SubjectID) Can i only use one column as Foreignkey, or do I always have to get all the columns? Thanks! ...

Return parent records with child records equaling specific values AND where total set of child records for a given parent equal a specific value

Currently I have a query that returns parent data for parent records that have a subset of child table records equaling certain values. However, I want to narrow it to only return those parent records with children having certain values, but where those are the only child records belonging to given parent or where the number of child re...

altering a column to be nullable

I want to alter a table column to be nullable. I have used: ALTER TABLE Merchant_Pending_Functions Modify NumberOfLocations NULL This gives an error at Modify. Can someone tell me why? Please!! ...

Optimising page processing by creating advanced SQL query

Hi there. I have this weird code on site. It gets all records (order by pozycja), then it creates some kind of stack and limits shown records to 10. However if there are over 200 records, it takes too long, because it's processing whole table, instead of 10. Values used: $int_ilosc_na_strone = 10; $liczba_wierszy = 200; Podzial_na_pod...

Open Source Contact Database Program ASP.NET And MSSQL or PHP And MySQL?

Hey Hivemind.. I Am currently looking at building an Open Source People Intelligence Application (Fancy Word for a phone book) for my church.. It'll basically be a database system where you can view info on a person and automate actions like send a "facebook message to these people on this date", "Generate a consent form for this perso...

sql server 2008 application with wpf

I made an application using blend3 and SQL 2008 how can I make this application work on another PC with its database without install visual studio 2008 and how to install SQL 2008 in this case ? should I create new database or what ? ...

executing stored procedure via odbc from axapta

hi there, we're currently executing a stored procedure ( ms sql 2008 ) from axapta ( ax 2009 ). the sp is indeed quite large and the obfuscating effect is, that the sp doesn't work, if triggered via odbc. a simple "exec sp ..." executed via ssms works fine. if we remove some of the last queries executed in the sp, the sp also works fire...

Select is much slower when selecting latest records

A table with about 70K records is displayed on a site, showing 50 records per page. Pagination is done with limit offset,50 on the query, and the records can be ordered on different columns. Browsing the latest pages (so the offset is around 60,000) makes the queries much slower than when browsing the first pages (about 10x) Is this an...

How does the SQL connection in an application should be called?

Back to basics. I have an application written in c# and I am using the sqlClient to connect to database. I have several methods and I usually open the connection in a try catch block try{ **open connection** //Mehod1() //Method2() ........ }catch(exception){ //Do something }finally{ **close connection** } The P...

Where does SSMS save user created templates?

Does SSMS save these to a file location or are they managed internally thru SSMS? If there is a location where is it? ...

How to create report from SSIS package when its executed?

Hi All, I have an SSIS package that loads data in a table. How do I create a report from that table every time the package would run? NOTE : I asked somebody about this issue and this is what he told me: Create a variable called SSISReport and update that variable in package configuration so every time you have the records in that tab...

Does it matter where I check part of a composite key when joining two tables in SQL Server?

I'm joining two tables on a composite key, and I'm wondering if it matters where I compare the corresponding columns when I do the join. Say I have a table, TableA, with columns ColAFoo, ColAFoo2, and ColABar. TableA has a composite primary key comprising ColAFoo and ColAFoo2 (PK_TableA). I also have TableB, with ColBFoo, ColBFoo2, an...

Counting groups of data in SQL

I have a table of about 1.6M rows where the records have a unique (identity) ID and then also have a 8-character "code" field. The code field it used to group data into sets...all rows with the same code are in the same set. Each set should consist of 12 records, but it seems our data load was off and some sets are incomplete. I need ...

SQL Code wont take when running in PHPmyADMIN or Navicat

I have the following code but it keeps presenting errors. The first part of the code creates the necessary table followed by - what should create stored procedures but it does not. any ideas? drop table if exists agent; create table agent ( agent_id int unsigned not null auto_increment primary key, name varchar(32) not null, commissio...

Oracle SQL - select within a select (on the same table!)

Hi guys, I'll try and explain what I'm trying to achieve quickly, since I have no idea how to explain it otherwise! We have a table here that shows all employment history for all employees, I want the "Start_Date" of the current post ("Current_Flag" = 'Y'). As well as that, I want the "End_Date" of the post before that (was going to fi...

Is it possible to join two tables on one column = concatenation 2 columns?

Table A has column X, which is an int made up of the concatenation of columns Y and Z (which are both floats) in table B. I want to join tables A and B in a manner similar to this: select * from tableA a inner join tableB b on a.X = b.cast(concat(cast(b.Y as varchar), cast(b.Z as varchar)) as integer Except that, obviously, my example...

Does it matter where I check part of a composite key when joining in SQL Server using a user-specified value for part of the join?

(this question is very similar to my previous question Does it matter where I check part of a composite key when joining two tables in SQL Server?) I'm joining three tables on a composite key, with the value of one of the columns being determined by user input. I'm wondering if it matters where I compare the corresponding columns when ...

Populating a WPF listbox with items from an SQL (SDF) database

Hi! I have been searching on how to do this for a very long time, and I have not managed to get a straight answer on the subject, so hopefully one of you StackOverflow users will be able to help me here. I have a WPF ListBox named CategoryList and a SDF database called ProgramsList.sdf (with two tables called CategoryList and ProgramsLi...