|
I have a table called products with a unique id column called ProductId .
The products table contains 124 rows.
I have another table called receipts containing
ReceiptId
ProductId
Quantity
The ProductId would contain a ProductId from the Products table.
So what I want is a list of 124 products and the quantities received next to each product with a particular ReceiptId
Basically
ProductId Quantity
1.........10
2.........NULL
3.........NULL
4.........5
5.........NULL
NULL being where there is no receipt
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
|
Dave
Thanks for the help.
My solution is as follows :-
SELECT NULL as TicketId, *, NULL as Quantity
FROM vuDepotProducts
WHERE NOT EXISTS(
SELECT * FROM vuReceipts WHERE DepotId = vuDepotProducts.DepotId AND ProductId = vuDepotProducts.ProductId AND TicketId = 330804
)
UNION
SELECT * FROM vuReceipts WHERE vuReceipts.TicketId = 330804
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi
I am trying to import a CSVs file using OPENROWSET and import this into a database
my problem is the CSV files may contain a varying number of columns
i have tried using
SELECT BulkColumn
FROM OPENROWSET (BULK '\\10.1.2.107\rp_uploaded_files\file.csv', SINGLE_CLOB) MyFile
but this puts all the values into one fields
i have also tried
set @string ='BULK INSERT CSVTest FROM ''\\10.1.2.107\rp_uploaded_files\'+@file+''' WITH (FIELDTERMINATOR = '','',ROWTERMINATOR = ''\n'')'
exec (@string)
but this requires the destintation table to have the same number of columns as the import file
Can anyone advise
thanks
Simon
|
|
|
|
|
|
HI Guys,
I have problem reading images from ms access database!
there is a clinic software who was written by a bankrupted company,
and now it doesn’t work by the some reason, and there is no support on this software,
All things that I should do are recover the patient’s data that was written by doctor handwritings in his notebook tablet-pc.
I think the doctor's handwriting must be saving as images in the patient’s records. The problem is I couldn’t read it from database because the data are like this:
AIfIAR0E2A/uBgIZAkgRBUgRRP8BBEgQRTUKSBFXDQAAAFD/AQQDATgAGCIgMgkA9P8CAekiOkUzCQD4nwIBWiA6RTgIAP4DAAAAgH8ADw4S+SONP88jjT8RAACAPx4+4gKD/glK/glJAAAAAAAAAAAYyAAAAAAAAAAAAAAAAAiQIkAAAAAAVMgAAAAESAEJAAAAAAxkAAAAAAIfEAAKLw+E+44+492VloilKFtOjSCG4PDhA6KAjpKCkI
I think images must be converted from binary to another type.
If anyone could help on this he/her save my life!
i attached the database file here/:
http://rapidshare.com/files/302706380/test.accdb.html
there is a tables in the database, and all thing that i need is the "VISIT Table" 's information on the column by the name "NOTES", i think it must be image.
HELP ME,THis IS UrGENT Problem!
|
|
|
|
|
Hi,
I am trying to install sql server 2008 from the last three days..but there was no progress.Earlier,I have SqlServer 08,but that was crashed,So I am trying to install sql server 08 from the begining.
So,
1)I have uninstalled the existed Sql server 08
2)Removed all the features from control panel->Programs and features and no sql services existed in the Services
3)Completely removed the folder"Microsoft SQL Server" from C:\Program Files.
4)Removed sql related registry keys from HKEY_LOCAL_MACHINE\Software\Mocrosoft\
When I am Installing ,I am able to install till support Files only.Supporting files are successfully getting installed .After support files,It is not showing any further windows (like Feature Selection Window etc),and again it is showing the starting window .So,I couldnot move forward.Please help in this to go ahead.
Thanks,
Krishna
|
|
|
|
|
Hi,
I my stored procedure I have an insert query. For this I have to get one value from a sub query. But it is not accepting that query. So I tried to declare a separate variable and assign the subquery value to this and insert it in the table.
Create Procedure [dbo].[AddOrRemoveFavourites]
(
@UserId bigint,
@VideoName varchar(50),
)
as
Declare @VideoId int
Set @VideoId = Select VideoId from Videos where Title='Monkeydog'
Insert into Favourites(UserId,VideoId) values(@UserId,@VideoId)
but in this I am getting error like "Incorrect syntax near the keyword 'Select'."
If anyone have any idea to solve this please reply me.
Thanks in advance.
|
|
|
|
|
Try this one;
SELECT @VideoId = VideoId
FROM Videos
WHERE Title = 'Monkeydog'
I are Troll
|
|
|
|
|
Hi,
You need to enclose your select in parenthesis and include a top(1) clause, like this:
Set @VideoId = ( Select top(1) VideoId from Videos where Title='Monkeydog' )
Regards,
Syed Mehroz Alam
My Blog | My Articles
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein
|
|
|
|
|
Hi,
Set @VideoId = Select VideoId from Videos where Title='Monkeydog' is wrong
use
Select @VideoId = VideoId from Videos where Title='Monkeydog'
The reason is if we want to assign values to more than one variable at a time then go with Select.
SET allows you to assign data to only one variable at a time.
For more information visit here http://vyaskn.tripod.com/differences_between_set_and_select.htm[^]
Also searching in google will reveal more info
Niladri Biswas
|
|
|
|
|
Hi...
I want to know the diffrence between SQL Express and SQL mangment studio.
On my PC which is standalone ,SQL server 2008 Insrtalled but I unable to see any database
or anything.I can see only Configration manager.
So On my pc SQL express installed or Only Managment studio installed ?
Which application I have to install so I can create the database ?
|
|
|
|
|
One is a database edition
The other is a management toll for the database (create and test database objects, tables, views, procedures etc)
|
|
|
|
|
|
SQL Express[^] is the "express" version of SQL Server, meaning that it's a trimmed down version of SQL Server and available as a free download.
SQL Management Studio[^] is an IDE to manage databases.
In other words, the first thing is a database-server, the second thing is a GUI to manage that server.
I are Troll
|
|
|
|
|
sql query aur ms access main
when i pass "select maid) from enquiry where regdate=#05/11/2009#" from sql
access treate it as 11/05/2009
why???
and wats the solution
|
|
|
|
|
Try this
select maid) from enquiry where regdate=#05/Nov/2009#
or this
select maid) from enquiry where regdate=#2009/11/05#
Read up on datetime
|
|
|
|
|
But for this i have to change Date/Time format of System to what u written.
|
|
|
|
|
In Access you MUST be storing your data as a datetime data type, if you are storing it as varchar/string then you are screwed.
SQL Server has a dateformat, I presume that Access has something similar (I know it has I just can't remember the format). This will allow you to control the format of the datestring when you need it.
|
|
|
|
|
Thats true, type in access is date/time and format is "Short Date - 26/12/2009".
When i call this through SQL it change dd/mm/yyyy to mm/dd/yyyy.
Where to change, in sql or access??? As i cant change system date / time format.
tell
|
|
|
|
|
sachees123 wrote: Where to change, in sql or access???
Well, do you want to change the format that Access uses, or the one that SQL Server uses? For SQL Server, you'd set the time format like this;
SET DATEFORMAT ydm;
sachees123 wrote: As i cant change system date / time format.
The user is the one who sets (or changes) the format, from the control panel. Other applications should display their dates using the format that the user provides. That means that one saves a datetime as a DATE -type. When displaying, convert to a string of the ShortDateFormat or LongDateFormat
I are Troll
|
|
|
|
|
I dont want to change any format anywhere. Its the access which is changing the format from dd/mm/yyyy to mm/dd/yyyy. Why it is doing and wats the solution?? Thats my question.
|
|
|
|
|
sachees123 wrote: Its the access which is changing the format from dd/mm/yyyy to mm/dd/yyyy.
Databases don't store dates in a specific format, they store them as numbers[^]. The database applies one of the predefined dateformats when you retrieve the value. You can change[^] the table-design to change the default format that's used for the date-column though.
I are Troll
|
|
|
|
|
Key announcements were made at PASS Summit 2009 about SQL Server:
Upcoming SQL Server 2008 R2 community technology preview (CTP) would be available in November.
SQL Azure is now feature-complete and goes live in January.
Two new editions of SQL Server to address high-end, mission-critical scenarios:
Microsoft SQL Server 2008 R2 Datacenter
Microsoft SQL Server 2008 R2 Parallel Data Warehouse (formerly project code-named “Madison”)
For more information, see Two New Editions Join SQL Server 2008 R2 Roadmap[^]
|
|
|
|
|
Hi,
I have one SQL query, i want to update it in one database. Please check that SQL query below.
update employee set emp_name = 'Ravi' where emp_id = 1
Now i want to get the count of how many rows get updated..
Can any one help me out as it urgent requirement for me..
Thanks
John.
|
|
|
|