|
Hi My Friends
When We Backup a Database We just Backup From Tables
How Do I Move Stored Procedures And Views When Backup database With Sqlserver?
|
|
|
|
|
Hi,
If you are using Management Studio for SQL 2005 then you can navigate to the Database->Programming
-> Storage Procedures, and in the object explorer details page, select all the procedures right click and select "Script Stored Procedure As" -> Create To -> New Query Window (or File if you'd like). This will back up your stored procedures.
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
thanks for your help
is there any way to do this with out wizard ?
i want to do this in my program that write with c# and sqlserver
|
|
|
|
|
i need to layout a giant database
however, i dont have visio. are there any free and easy flow chart programs?
it is just database layout and nothing more complicated...but paint really is not helping me much with this.
-----------------------------------------------------------
"When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford
Moved on Monday, July 21, 2008 10:26 PM
|
|
|
|
|
What kind of database is it?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
relational. huge bastard.
-----------------------------------------------------------
"When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford
|
|
|
|
|
I meant, MSSQL, Oracle, MySQL, which one?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
you know i thought you meant that...but i was trying to get the smell out of the kitchen from letting my cooking attrocities hang too long.
MSSQL
-----------------------------------------------------------
"When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford
|
|
|
|
|
|
nice. thanks
-----------------------------------------------------------
"When I first saw it, I just thought that you really, really enjoyed programming in java." - Leslie Sanford
|
|
|
|
|
Pen and Paper are your friend.
Back in Uni I have had pen and paper assignments that were larger and more complicated than real-life assignments.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hello,
I need to create a view to a database on a remote server, and I found linked servers in SQL. I mostly got it to work, except for one subtle requirement.
The database name on the remote server can change, and I don't want to hard code it in my views (also for testing purposes).
When I call sp_addlinkedserver[^] I can specify a default database name as the last parameter.
The thing is, what's is it for? The way to connect to another server is using the four part notation ([server].[database].[owner].[table] ) such as SERVER2.ShippingDB.dbo.Shipments . But if I specify a default database when creating the linked server, I suppose I should be able to obviate the database name, like this:
SELECT * FROM SERVER2..dbo.Shipments
I've tried it and I get this error messege:
Msg 7313, Level 16, State 1, Line 1<br />
An invalid schema or catalog was specified for the provider "SQLNCLI" for linked server "SERVER2".
I've searched all around the net and I only found a post in MSDN forums asking the same thing, but no answer.
Any ideas?
Thanks!
|
|
|
|
|
Just a guess. Maybe catalog (or default database) has actual meaning only on OLEDB-queries?
I'm not able to test this at this time, but if you can try what happens if you modify your query to use OPENQUERY-call:
SELECT * FROM OPENQUERY(SERVER2, 'SELECT * FROM dbo.Shipments')
Any difference?
Mika
|
|
|
|
|
Mika Wendelius wrote: Maybe catalog (or default database) has actual meaning only on OLEDB-queries?
After I saw your post, I tried this:
EXEC sp_addlinkedserver @server ='TRW', @srvproduct = '', @provider = 'SQLOLEDB',
@datasrc = '127.0.0.1', @location = NULL, @provstr = '', @catalog = 'trw_data' and it didn't work either.
OPENQUERY seems to work fine. One question though: Performance-wise, is it a good choice if the remote table pontentially will have a lot of records? I suppose that if add a filter in the inner query, it would be faster. But what if that filter were dynamic? The only thing I can think of is to build the query with string concatenation before passing it to OPENQUERY .
Thanks, you got me into the right track.
|
|
|
|
|
Good question!
Dynamic SQL seems to be the only option and since you cannot use variables inside OPENQUERY, all the conditions must use literals for values. This however isn't so big problem any more in SQL Server 2005 than it was in earlier versions since the database is now much more intelligent in reusing SQL statements.
Also one caveat is that max size of the query string is 8K. Because of that and performance reasons, maybe you could create a view or views at remote site and try to use as many static filters in the view as possible.
Glad that it helped
Mika
|
|
|
|
|
I was thinking about building a query string, and passing that to OPENQUERY . But it can't be done. You can't even concatenate anything in the OPENQUERY call itself.
I'll have to see how big my remote table is. I would rather not modify the remote database, but if that is the only way, I'll talk to my customer.
Thanks for your help!
|
|
|
|
|
You're welcome
A little trick that came into my mind which could be useful to you.
BEGIN
DECLARE @remoteQuery varchar(8000);
SET @remoteQuery = 'SELECT * FROM OPENQUERY(SERVER2, ''SELECT * FROM dbo.Shipments'')'
PRINT @remoteQuery
EXEC (@remoteQuery)
END
Mika
|
|
|
|
|
hi everyone,
I've a table in which the primary key needs to be a six digit number and must start from 1, so for that I made it an identity key (100001,1) but the problem is that I can't figure out how to restrict this to not exceed 199999
I'm using Sql Express 2005 as the Database. As far as I've seen while googling it out. There's no obvious way to do that. Can anyone comment on that plz?
Thanks in advance
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
this can be done using either with Check Constraint or Trigger
Regards
KP
|
|
|
|
|
oh yea, I just got this in mind a few minutes ago,
Thanks
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Seems like a design nightmare. What is going to happen when the data grows past that number? Also you are breaking the cardinal rule of record identifiers, you are assigning intelligence to the ID field. Next I suppose you are going to sort by the id field!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
well I've asked almost the same question from the designers of the db but I'm still waiting for their response on this. But if they do insist I guess I'll have to say: As u say Mr. XXX
Ur damn right:
Mycroft Holmes wrote: Never underestimate the power of human stupidity
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Rocky# wrote: designers of the db
Oh - you don't own the design , poor bugger, my sincere sympathies.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ahhh, well, its the designers themselves who r gona suffer at the end.haha I pass ur sympaties to them
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
i don´t know what you have in mind but if you trigger a SP to add data to one table, edit in that SP a if/else statement that counts the table records and; 1) add a record or 2) the display a error info message to the user.
|
|
|
|