|
if you want to extract only date
you can use datepart function as
SELECT DATEPART(month, GETDATE()) AS 'Month Number'
but if you want to see full date u can use
format = "d" or mm/dd/yyyy
|
|
|
|
|
Hi all,
I need to pass the result set from my main report (well, only 1 column, but all values for that column) as a multi-value parameter to a subreport. I know I can have an output parameter from an SP, but that only works for 1 value as far as I know. Is there any way to do this?
Thanks in advance.
OytotheVey
|
|
|
|
|
You could use OpenXML, turn the column into an XML string, pass that through and turn it back to a table in the second proc.
Christian Graus - C++ MVP
|
|
|
|
|
Thanks for the quick response!
Unfortunately I'm not that well-versed in OpenXML, so failing that, is there any way to do this in SQL Server?
OytotheVey
|
|
|
|
|
The books online has heaps of good examples. I don't know another way, no.
Christian Graus - C++ MVP
|
|
|
|
|
Hi,
We have existing tables and a database diagram in SQL2005 - would like to convert the tables and database diagram to Oracle 10 - is there some type of a convertor tool to do this? How can we go about doing this other than trying to create the tables manually??
Many thanks.
|
|
|
|
|
I have Created a FullText Indexed table to store the Doc files.
I want querying the DocAuthor,Size, etc.. from Full Text catalog, not from OS Physical file.
I am using Sql Server 2005.
Regards
Fenil
|
|
|
|
|
Hi to all
Actually we have some data stored in the sqlserver database.know it's time for us to deploy our project ,before doing that we need to generate the script file for the records available in the database and give to the client for the sake of installing the content present init in the server.while we r doing this ,we r able to generate the transact queries for the generation of the tables ...it wasn't invoking the data present in it......how come we do it, plz let me know...!,suggest me the better way's,or u can send the articles related to this type of scenarios
Thanks in Adv
|
|
|
|
|
Export the data to flat files then write an import program to import them. Or use a batched DTS package.
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
Or send them a backup of your database instead.
|
|
|
|
|
Hello, i want to copy an image from one row into a other row in the same table...
update TabelName Set Thumbnail = (Select Thumbnail from TabelNAme where Info = 'Test1') where Info = 'TEst2'
But it do not work thx BEnny
|
|
|
|
|
Try putting in a closing bracket
update TabelName Set Thumbnail = (Select Thumbnail from TabelNAme where Info = 'Test1') where Info = 'TEst2')
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
|
hi,
i have to display all the sold product names of a particular month along with the date on which they are sold .
This month and year will be selected by user using dropdown list .
How should i write query to compare selected month and year with the "Date" field of datetime type in DB stored in format mm/dd/yyyy hh:mm:ss.
Please Guide.
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
Use Year and Month functions in your query
SELECT product.name<br />
from product inner join sales on sales.productid = product.productit<br />
where Year(SalesDate) = @Year <br />
and Month(SalesDate) = @Month
this saves you having to work out how many days in a year.
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
There is a two way:--
1. You can change date format before storing it into database.
2. You can get date with time from database and change it format according to the requirement. And compare it.
|
|
|
|
|
Hello.
I am working on a project which involves reading from and writing to an excel file. I'm having a few bugs at the moment. I can only get it to write if there is already data saved in the excel file. Second, after it does save the data, my attempt to re-read it only results in OLE stating that there is only one column of data, even though there is obviously 3. It works if i resave it in Excel, but that's not really a viable option as this program is supposed to automate things. If anyone has experience with OLE and has a solution or at least a suggestion for some of these problems, please post a response.
Thanks in advance.
-- Steven Hunt
|
|
|
|
|
Yes I've done this and you want to look on codeproduct for a free class that allows writing/reading of excel files.
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
You can use ADO.net (or just plain ADO) and treat the excel sheet like a datbase table. Use the Jet Engine with an excel specific connection string and reference the appropriate sheet as $SheetName (sheet name prefixed with $). I have used Carlos Antonini's C++ ADO wrapper classes successfully with Excel in this way. ADO.Net with DataTables/DataReaders and SQL commands works as well.
|
|
|
|
|
Hey guys
Using Sql/express
Table 1 :
I set 3 fields to be primary keys for Table1 (i have just marked each field with a key (primary key)(is there anything else to do)?
Table 2 :
I should add a foreign key for this table linked to the 3 primary keys of table1
Can this be done /how? Any hint for that?
thx
Regards
Ramy
|
|
|
|
|
charchabil03 wrote: Can this be done /how?
Yes, you are permitted upto 16 columns to form part of a key (although if you are using 16 columns, you might want to review your design).
Your foreign key must match the primary key. So if you have int, char(5), datetime as your primary key, the foreign key must also be int, char(5), datetime.
|
|
|
|
|
Read books online for SQL server (I'm making an assumption your using it).
Create PK single value
ALTER TABLE dbo.Table ADD CONSTRAINT [PK_ID] PRIMARY KEY CLUSTERED
Create FK
ALTER TABLE [dbo].[MySecondTable] WITH NOCHECK ADD CONSTRAINT [FK_Table_ID] FOREIGN KEY([TableID])
REFERENCES [dbo].[Table] ([ID])
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
Is there a way for me to check if a database exist programmatically using C# before I create a new database? I would also like to check if a table already exists in the database or if a column already exists in the table, thanks.
|
|
|
|
|
Connect to the master db then
<br />
<br />
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'MyTable')<br />
Select 'We have a table
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
Frank, the sample code you provided checks to see if a database table exist, correct? Is there something similar to check if a database exist? Is there some method in the Sql.Client namespace that I can pass in an sql command string to check if a database or table exist and it will return me a true or false? Thanks.
|
|
|
|