February 19, 2009 at 1:20 pm
Hi There
you are right, my mistake
But After I fix the DDS of one table then it says "Invalid Object Name 'dbo.BOCLEARED' "
DO YOU KNOW WHY
February 19, 2009 at 1:22 pm
josephptran2002 (2/19/2009)
Hi Thereyou are right, my mistake
But After I fix the DDS of one table then it says "Invalid Object Name 'dbo.BOCLEARED' "
DO YOU KNOW WHY
Usually that means that there is not an object called dbo.BOCLEARED. Maybe it's spelled differently? Maybe it has a different schema (the owner, it says 'dbo' but it could be something else).
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 19, 2009 at 1:24 pm
josephptran2002 (2/19/2009)
Hi there,How can I copy the script of my CREATE TABLE?
THank you
P.S: I'm new to SQL, sorry I try to learn as fast as I can
Have you tried reading the first article on asking for assistance I have referenced below in my signature block? It would be a good place to start.
February 19, 2009 at 2:00 pm
Hello Grass
Why I type exactly the name appears on the Master database but it still gives me "Could not locate entry in sysdatabases for database 'Regional'. No entry found with that name. Make sure that the name is entered correctly. "
How can I copy and paste? so i can get the correct name of the master database.
Thank you Grass
February 19, 2009 at 3:30 pm
First, there is no one here by the name of Grass. Second, are you looking for SQL Servers master database (which is named master) or are you looking for your applications "master" database that may have any name?
If you are running SQL Server 2005, run this query and put the results here:
select * from sys.databases;
February 20, 2009 at 9:33 am
Hello Grasshopper,
How are you doing?
I type the code that you told me and it works the first part:
Use [Regional Office Claims Adjudication Process-Disability (ROCAP)];
If Object_ID('GRANDTOTAL') IS NOT NULL DROP TABLE GRANDTOTAL;
CREATE TABLE GRANDTOTAL (BOCLEARED INT, CTCLEARED INT, MECLEARED INT, NHCLEARED INT, RICLEARED INT, WOCLEARED INT, VTCLEARED INT, TOTALCLEARED INT);
But the second is not working, DO YOU KNOW WHY?
Insert into GRANDTOTAL
Select
(Select sum(BOCLEARED) from dbo.BOCLEARED),
(Select sum(CTCLEARED) from dbo.CTCLEARED),
(Select sum(MECLEARED) from dbo.MECLEARED),
(Select sum(NHCLEARED) from dbo.NHCLEARED),
(Select sum(RICLEARED) from dbo.RICLEARED),
(Select sum(WOCLEARED) from dbo.WOCLEARED),
(Select sum(VTCLEARED) from dbo.VTCLEARED),
(Select sum(TOTALCLEARED) from dbo.ALLCASESCLEARED)
Error Message: "Invalid object name 'dbo.BOCLEARED' " But the table dbo.BOCLEARED is existing and the column name BOCLEARED is existing in the table.
Thanks
February 20, 2009 at 11:45 am
If you're talking to me, my handle is bvaljalo, not grasshopper.
And to be honest, I dunno what is going on with your problem. Does BOCLEARED live in the ROCAP database, which is the one your session is connected to because that's the one you've USEd. And are you using the dbo schema to save your tables?
When you look at the existing tables in your ROCAP database (using MSSMS), does there exist a table name dbo.BOCLEARED? Because if that table is in a different database, then you have to fully qualify the table name like this: databasename.schema.tablename.
Also, as I mentioned before, I would personally advise against having fields within a table that have the same name as the table itself, so if you have control over that, I would change either the table name or the field name so that you don't have a field called bocleared in the table called bocleared. I doubt that is what the problem is, but it's still not a good practice in general. Kind of like how you shouldn't name a field using the name of a built-in function like SUM.
February 20, 2009 at 12:17 pm
Hello bvaljalo
First, I apolozige for not knowing your name because I am new to this SQL.
I did change the field name and it still says that dbo.BOCLEARED is not valid object name. But I have dbo.BOCLEARED in VIEWS, and it says like that. However, one time I tried and it worked. But after that it's not working. DO I have to run in master database or ROCAPData where is the menu bar with the dropdownbox.
DO I Have to run on new query on the menu? or in VIEWS?
Insert into GRANDTOTAL
Select
(Select BOCLEAR from dbo.BOCLEARED),
(Select CTCLEAR from dbo.CTCLEARED),
(Select MECLEAR from dbo.MECLEARED),
(Select NHCLEAR from dbo.NHCLEARED),
(Select RICLEAR from dbo.RICLEARED),
(Select WOCLEAR from dbo.WOCLEARED),
(Select VTCLEAR from dbo.VTCLEARED),
(Select Sum(TOTALCLEARED) from dbo.ALLCASESCLEARED)
February 20, 2009 at 12:23 pm
From the sounds of things, not everything is in the same database. I'm not sure that's a mistake or by design. In general, if you're getting an error that says something doesn't exist, you either have a typo, or it really doesn't exist.
If you are intentionally working across databases, then you need to include the database name as part of the table reference within the query:
SELECT *
FROM mydatabase.myschema.mytable AS a
JOIN myotherschema.myothertable AS b
ON a.ID = b.ID
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 20, 2009 at 12:24 pm
I just have to ask: What does not knowing someone's name have to do with being new to SQL? If you look at your own posts, you'll see that your name is in bold at the top. It's the same for everyone else.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 20, 2009 at 12:25 pm
josephptran2002 (2/20/2009)
Hello bvaljaloFirst, I apolozige for not knowing your name because I am new to this SQL.
I did change the field name and it still says that dbo.BOCLEARED is not valid object name. But I have dbo.BOCLEARED in VIEWS, and it says like that. However, one time I tried and it worked. But after that it's not working. DO I have to run in master database or ROCAPData where is the menu bar with the dropdownbox.
DO I Have to run on new query on the menu? or in VIEWS?
Insert into GRANDTOTAL
Select
(Select BOCLEAR from dbo.BOCLEARED),
(Select CTCLEAR from dbo.CTCLEARED),
(Select MECLEAR from dbo.MECLEARED),
(Select NHCLEAR from dbo.NHCLEARED),
(Select RICLEAR from dbo.RICLEARED),
(Select WOCLEAR from dbo.WOCLEARED),
(Select VTCLEAR from dbo.VTCLEARED),
(Select Sum(TOTALCLEARED) from dbo.ALLCASESCLEARED)
Please tell me that this is a joke and you really do know what you are doing, because this is getting to be a bit ridiculous.
February 20, 2009 at 12:26 pm
You have to run it in the database that has the tables and views in it. If that database is ROCAPData, then run it in there.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 20, 2009 at 12:32 pm
Hello Grant Fritchey,
I have 4 tables such as BOCLEARED, CTCLEARED, NHCLEARED, and TOTALCLEARED.
In table BOCLEARED (given), it includes 3 columns such as
DDS BOCLEARED BOCLEAREDDATE
In table CTCLEARED (given), it includes 3 columns such as
DDS CTCLEARED CTCLEAREDDATE
In table NHCLEARED (given), it includes 3 columns such as
DDS NHCLEARED NHCLEARED
In table TOTALCLEARED (given), it includes 3 columns such as
DDS TOTALCLEARED CLEAREDDATE
Now, I wish to create a table which calls GRANDTOTAL and the table "GRANDTOTAL" is going to be built by taking one column of each table and transfer the data of each column such as BOCLEARED, CTCLEARED, NHCLEARED, and TOTALCLEARED. After being transfered to a brand new table calls GRANDTOTAL, I wish to calculate the sum of each column (the total at the bottom of each column).
Table GRANDTOTAL
BOCLEARED CTCLEARED NHCLEARED TOTALCLEARED
Thank you so much
February 20, 2009 at 12:37 pm
Hello Lynn Pettis,
I have already apoloziged to that person. If I know what I am doing then I won't bother anyone here. I am at the learning to be like you guys. So that why I ask questions nicely. I did not swear nor saying any bad words here. But I am really appreciated your helps too.
Thank you
February 20, 2009 at 12:42 pm
I'm not going to help perpetuate a farce. Best advice I can give you right now is to go ask your supervisor for training in SQL Server development. This isn't something we can really do over a forum, and it doesn't do you any good if we do your work for you.
Viewing 15 posts - 16 through 30 (of 41 total)
You must be logged in to reply to this topic. Login to reply