|
Hello All,
Need to move certain tables, not all tables from one database to another database, all the data and its properties. This is in SQL 2005?
Any pointers?
Thanks!
|
|
|
|
|
you have many choices.
1. import and export
2. using the following code, but it don't copy across any indexes etc.
select *
into database.owner.tablename
from table
MSDN : Select into[^]
As barmey as a sack of badgers
Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.
|
|
|
|
|
By performing the select, it does not copy over the indexes set up on the table, it just copies over the data.
All features/properties of the table needs to copied over?
|
|
|
|
|
|
Dear all,
am doing the follows:
Public Function totalsumbycontract(a As String, b As Integer) As Double
Set classdb1 = CurrentDb()
set classrecset1 = classdb1.OpenRecordset("select unit_price from contract_details where contract_number = ' " & a & " ' ")
end function
where a is the contract number, and b is contract id. the problem is when am runnig the query by using contract number, it returns 0 records, while by contract id , it works fine.
Contract number is defined in table desig as TEXT, and id is defined as number. also if i run the query on the table it self by contract_number , it works fine.
only when am using the query in this code , its not working.
Dunno wahts the mistake i did?? and have no clue ?? its just a simple line of code
Can any body guide ??
0 will always beats the 1.
|
|
|
|
|
You wrote:
set classrecset1 = classdb1.OpenRecordset("select unit_price from contract_details where contract_number = ' " & a & " ' ")
Nothing to say without seeing your table.
Checkout "contract_number" is that string type or number. If Number type just remove the single quotes.
|
|
|
|
|
how do i get top 3 salaries among department, which is represented by employee with lowest 3 salaries (total 9 rows)
please reply.
|
|
|
|
|
Please rephrase your question or give some sample records as an example. It's hard to figure out what you really want.
|
|
|
|
|
Please explain ur question. Its not clear for me. Can u come up with any example?
abhi
|
|
|
|
|
It needs kind of presentation that what's your data and what you want as a final output.
Furthermore AFA I understood the problem I think you need to apply groupby in SQL and then after sort top 3 records among the retrieved result set.
further sample data can make me more clear regarding.
Regards,
Hiren.
be good(Help people in CP),do good(Vote if one finds helpful) all will happen good, In case happens bad(You are getting downvote for your best try to help OP) it will be good for later after(Countered with more points by humble member). - Gita sar in context of CP.
-So Guys don't care about downvote believe in you.
|
|
|
|
|
How to get data in financial year(april -march) in stored procedure in sql server 2005?I googled a lot.But didnt find suit answer.Hope you help.
|
|
|
|
|
Something like this you mean?
Inputparameter is int @fiscalyear.
WHERE (YEAR(yourdatefield) >= @fiscalyear AND MONTH(yourdatefield) >= 4)
AND (YEAR(yourdatefield) <= (@fiscalyear + 1) AND MONTH(yourdatefield) <= 3)
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
Because each company may have a different fiscal year, you need to actually have a strategy to deal with it in your data structure. there are a number of options!
Have a function that converts a date to finscalyear/period (2010/01 = April)
Actually store the correct fiscal values with the data.
Maintian a "Period" table with all the relevant dates and FK it to your data (we use this method)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My company is currently running SQL Server 2005 and we have out main project database set up on it. Everyone in the company can connect to it through Access using a linked table. This was setup a little while back by another company. However my company has now asked me to create a small database on the server. So I logged into the server, created the database, added the needed columns and the data we have already accumulated that need to be in the database. However when I try to link it through Access it won't let me; the connection fails. I can't do it through the ODBC Data Source Administrator either. I did notice though that when I try and create a new data source through the ODBC Admin that regardless of whether I select SQL Server or SQL Server Native Client 10.0 our main project database comes up (it is set up though to use SQL Server not the Native Client), however the new database only comes up if I select SQL Server Native Client 10.0. I'm thinking, and hoping, this is why I can't connect to the database from my laptop but I'm not sure. Why does the new database only come up under the SQL Native, but the main project database comes up under both, and how can I make the new database come up under the SQL Server option? I've compared both database properties and everything seems to be exactly the same. I'm pretty new to SQL Server but the company has put this on me and given me a week to get it up. Any help would be greatly appreciated. Thanks.
Dominick
|
|
|
|
|
First test is to see if you can "ping" the server. This will test that the network connection from your machine to the server is running.
Open a command prompt and type "ping yourservername", (no quotes and substitue your server name for the first parameter.
Start with the simple stuff.
|
|
|
|
|
So a summary of the problem is as follows.
There is ONE database server - one physical box.
On that server there is database A.
On that server you created database B.
On your client box you CAN do the following with A (NOT B.)
- Create an ODBC connection and validate it.
- Via a NEW Access database, create a linked table to it
And with Database B you CANNOT do the above.
Given that we know for sure that is NOT a connection problem (per the other response.)
And the driver shouldn't have anything to do with it.
What it would suggest to me is that it is one of the following
1. User permissions on the database B. This is most likely.
2. Some odd firewall rules. This is hypothetical but I don't consider it impossible. Such a rule would need to be more than just a standard connection rule.
|
|
|
|
|
I am going to have data that will be represented in code by multiple flag-type enums.
Is it preferable to store this data in a database record as the integer value of the enum instance, or should I have a separate field for each value and store either a zero or a one to indicate whether that field is in use?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Store the numeric value and have a translation/referential integrity table.
And see my GenOmatic[^] article.
|
|
|
|
|
Richard Andrew x64 wrote: I [...] have data that will be represented in code by multiple flag-type enums.
..and what's the relational representation of the same data?
I are Troll
|
|
|
|
|
Well, I'm writing a rules engine and it will go something like this:
Where subject A, B, C, and/or D
performs function A, B, C, and/or D
raise alert A, B, C, and/or D.
And each record in the database will represent one rule.
So the choices from A to D will be represented in code by flag enums.
And I'm wondering if it's better to store each of the choices as the int value of the enum, or as separate fields.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Then think of the typical searches you expect to perform on the data; that should tell you the most fitting answer.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Richard Andrew x64 wrote: So the choices from A to D will be represented in code by flag enums.
That description sounds more like a 'name' to me rather than an enum.
|
|
|
|
|
we can get month names by using select datename(mm,getdate()).How to select the month numbers(eg:1,2,3...12) using select statement in sql server?Please suggest the format to select month numbers.
|
|
|
|
|
You can use datepart to retrieve the month number in SQL Server.
|
|
|
|
|
Which database system?
Doesn't SQL server use DatePart?
|
|
|
|