SQL Statement from VS2005 Reporting Services to SSMS - sql

When I make a report in Reporting Services I would like a way to automatically fill in some of the report's configuration in my database.
For example I have a table 'parameter' and a table 'report', how can I automatically insert the parameters and report name, from the report I just created using VS2005, in my database?
I am looking to use/write a plugin or something like that, or is there a method that is a lot easier but that I am just overlooking?
Your help would be very much appreciated :)

Put your insert code inside a stored procedure and call it in your data tab. Make sure you have insert/update permissions for the sql user.
Hope it helps!

Related

Transferring data from Excel to SQL multiple indexed tables

I have like 20 tables and one general table in SQL. That main table has indexes in in its columns. Using these indexes I create a view by getting the data from other 20 tables.
My question would be what would be the most efficient way to create a process of updating all of those tables accordingly using an Excel source. It should be future proof (new excel data being inputted once a month e.g.).
If it is a SSIS package how would it look, maybe you have any examples of something similar?
Thank you for the help.
I for one do not like SSIS. I find it a pain to troubleshoot, but for some tasks it's fine. If I were you I would:
Use the data import wizard from within Microsoft SQL Studio to import the Excel file.
Simply get the data into a staging table in SQL.
You'll have the option to save this as an SSIS package, good for automation
Now, write a pile of SQL to sort and update the data as you wish. Perhaps make a series of stored procedures
Create a job in SQL that runs your package, and then runs each stored procedure
Writing a solution in this fashion will allow you to troubleshoot each step and make reporting easy. You can just do the whole thing is SSIS but like I said, I'm not a fan of that tool. I like my code on the command line as much as possible for troubleshooting :)
I used this app from windows store to convert Excel into SQL script.
Then send script to our DBA.

How to write a query procedure that can be send to other local machines?(Beginner)

I have the database, tables, PK's and FK's, i need to send it to the other local machine, i tried writing some query's but it failed.
(Please be polite, just started :) )
You need to be more clear on your actual goal, the question is very vague. If you are trying to transfer data from one data base to another database, which is what I assume you mean, I would highly recommend using SQL server Integration Services. You create SSIS packages in Visual Studio and it will allow you to write simple queries from your data source and insert them into the tables of the destination database. You will need to download Visual Studio and install the integration services add on. Hope this helps.

Change the column's datatype for a partitioned table

My team has a database table that is partitioned running on SQL Server 2008 R2. In the table, there is a PK that is an INT. We're about to run out of INTs.
We plan on changing to BIGINT. We manage all of our data operations via DACPAC projects (Visual Studio's SQL project). One DACPAC for each database on our server. Thing is, we can't find an elegant way to change the PK column's datatype. We found a bunch of manual procedures that look useful, but we'd really like a script we can generate on the fly using DACPAC projects.
We're looking to automate this process, and have a simple one click script from the DACPAC that will update the DB in one fell swoop.
Might anyone know of an elegant solution?
Any help / suggestions would be greatly appreciated.
Thanks in advance!

Can Linq to SQL create a database from DDL files?

Is there anything built into the Linq to SQL libraries that allow me to create an entire database from a collection of DDL files?
Lets say you have a collection of DDL files, one for each table in the database. Conceptually it would be pretty straight forward to call a create table function for each one and each one that succeeds (does not through SQL exception for example due to a relationship or foreign key error) pop the file name off the stack. For any that failed you could try to call the DDL again until it finally succeeded and all of your tables existed in the database ... however ... if there is something like this that already existed in say Linq to SQL or the Migrations project that would be great. Does anyone know if this exists already without having to combine all of the DDL's into a single script? Thanks in advance.
If you have Visual Studio 2008 or 2010 Professional or Above, it includes the new version of database projects. Which can handle that precisely for you (it will even validate the scripts before execution so you can see what errors exists).
I don't believe so. Linq-to-Sql is not really made for manipulating database schemas. You might have more luck with something like the Microsoft SMO libraries.
Use ADO.NET commands instead for that. That should be able to handle it, depending how complex each file is. As long as each file has on executable statement, ADO.NET commands may work fine for what you want to do.

Stored Procedure to generate insert and create SQL for database

How can I move a db from one server to another (I only have access to the database with mylittleadmin). Like the title says, I guess the "easiest" way would be by generating SQL with a stored procedure.
I'm using SQL Server 2008 on both servers.
In the codeplex project Extreme T-SQL Script I have written T-SQL procedures to script the content of tables. I just abandoned its use myself in favor of ssms tools pack, but the later is no option for you.
When using these procedures in SSMS or VS the main problem is that Microsoft has limits on max column width and max length of output from Print-Statements.
I can't predict, which such limits exist when using mylittleadmin.
It depends on which datatypes and which varchar length you are using. Writing scripts that handle special needs is possible.
Further you need something to script the database objects first and it might be difficult to find something for that, as most people just use SSMS for this purpose. sp_helptext might help to script procedures.
In SSMS, you have the ability to copy or move a database from one instance of SQL Server to another. You can right-click on the database in SSMS, choose Tasks and then Copy Database...
Or, of course, you can simply backup the DB and restore on your target server.
(I have no idea what 'myLitleAdmin' is that you referred to)
You dont need to make a stored procedure. The easiest way to do it is by right click on your database -->task-->back up and create a backup.
after that you can restore your database on the other server.
If you have a license for myLittleAdmin then do as their web states. It says
"Purchasing a license gives you unlimited mail support.
Send your request at support#mylittletools.net"
Actually I found out that you could make a backup of the database in myLittleAdmin. The resulting .bak file was then emailed to me as a link.
Thanks for the comments though, voted up some of them :)