3
голосов
5ответов
30836 просмотров

How to copy a table schema and constraints to a table of different database?

What SQL can be used to copy the schema of a specified table to a table in different database?

1
голосов
3ответов
3896 просмотров

Truly empty element with sql server for xml-directive

How do I create a truly empty xml element with the for xml-directive in sql server (2005)? Example: select '' for xml path('element'), root('elements') Outputs: <elements><element></element></elements> But what I really want is: <elements><element /&gt...

0
голосов
2ответов
394 просмотров

How can I dump & load MS-SQL preserving identity columns?

I'd like to be able to dump & load a MS-SQL database so I can recreate the storage locations, the original database was poorly configured with 1 storage location and I'd like to correct this issue. My current attemtps at doing this have resulted in the identity columns being regenerated upon...

0
голосов
2ответов
121 просмотров

Archiving Reports SQL 2005 Reporting Services

Is there a way to configure the Report Server to Archive the reports to the Report Server or to a path on the File System. I need to save the reports generated as .pdf files.

0
голосов
2ответов
189 просмотров

how to select a particular table from a storedprocedure which returns multiple table?

I have a storedproc which has multiple select statement. When it is executed in sql server , it returns multiple tables. I need a query which will select a particular table from the storedproc e.g. sp_help. Please help.

0
голосов
3ответов
133 просмотров

Need to Develop SQL Server 2005 Database to Store Insurance Rates

Good Evening All, A client has asked that I develop a web application as part of his existing site built in ASP.net 3.5 that will enable his brokers to generate quotes for potential client groups. Such quotes will need to be derived using rate tables stored in a SQL Server 2005 database. The...

0
голосов
1ответов
478 просмотров

Stored proc does not display results

The stored proc below does not display any results with SQL Server 2005. I can take the same instructions and run it as a query and I get results, What am I missing. ALTER PROCEDURE [dbo].[usp_SubtractStops] @p NVARCHAR(1024) = '209 208 207 206 205 204 203 113 297 19 7 12 11 6 232 233 234 235 ...

3
голосов
3ответов
4872 просмотров

Oracle 10g express home page is not coming up

My Oracle 10g Express Edition , I can login in the SQL plus but I cannot login into oracle via SQL developer and cannot view the Home page at link http://127.0.0.1:8080/apex. This was working fine until yesterday. I have checked via (WINDOWS)netstat -ab and no other app is using the 8080 port. ...

4
голосов
3ответов
2867 просмотров

C# CLR Stored Proc won't Deploy to SQL Server 2005

I'm developing a C# SQL Server 2005 stored procedure that does data validation for my application. I have a nice framework built, that is working. The validation methods are along the lines of: private void TestDate() { TestFields(delegate (string value) { if (value == String.Empty...

1
голосов
5ответов
1390 просмотров

TSQL- Rollup SQL 2005

I have the following example code: create table Details( name varchar(20), age int, weight int, recordDate Datetime) --insert data ..query: SELECT a.name, a.age, a.recordDate, a.weight - (SELECT b.weight FROM Details WHERE...

4
голосов
3ответов
295 просмотров

What is the preferred merge method for SQL Server 2005?

I have mainly been using the Exists Method for merging a row into a table but I am considering switching to the Row Count Method. Is there any reason not to? Exists Method If Exists(Select * From Table Where ID = @ID) Begin Update Table Set Value = @Value Where ID = @ID End Else Begin ...

1
голосов
3ответов
2435 просмотров

Local vs Global temp tables - When to use what?

I have a report which on execution connects to the database with my_report_user username. There can be many end-users of the report. And in each execution a new connection to the database will be made with my_report_user (there is no connection pooling) I have a result set which I think can just...

0
голосов
1ответов
1674 просмотров

How do I insert values from an XML document into a temp table, in SQL Server?

Iam having one SP for which the input is a XML document . I want to insert the values from the XML into a temp table . How i can implement this one ...?

0
голосов
2ответов
549 просмотров

Can I retrieve config values for SSIS from XML in a table?

My current client stores all of their configuration information for the enterprise applications in a single table that holds XML. They then use a custom built front end to maintain the configuration values. I'm writing a fairly straight-forward import process for them using SSIS. I need to make ...

2
голосов
3ответов
1219 просмотров

Connection string error

Having a problem with IIS on Windows Server 2003 (using a classic ASP web application) The database server (SQL Server 2005) is on the same machine. I create a recordset, and set its activeconnection as follows: Dim RS Set RS = Server.CreateObject("ADODB.Recordset") RS.ActiveConnection = "Provi...

6
голосов
3ответов
9801 просмотров

SQL: how to select single record for multiple id's on the basis of max datetime?

I have the following SQL table, Id WindSpeed DateTime -------------------------------------- 1 1.1 2009-09-14 16:11:38.383 1 1.9 2009-09-15 16:11:38.383 1 2.0 2009-09-16 16:11:38.383 1 1.8 2009-09-17 16:11:38.383 1 ...

1
голосов
1ответов
3209 просмотров

Adding SSIS Connections Programmatically - Oracle Provider for OLE DB

I'm writing a C# application to generate an SSIS package. Part of this involves adding database connection managers - using the library Microsoft.SqlServer.Dts.Runtime. The following line of code shows how this can be done: ConnectionManager cm = pkg.Connections.Add("OLEDB"); In the above cod...

0
голосов
1ответов
243 просмотров

What is wrong with the following statement?

When I do this: select col1,case when [pivot1]=1 then '-' else '' end [pivot1], case when [pivot2]=1 then '-' else '' end [pivot2] from (select col1,col2,col3 from tbl) as c pivot (sum(col3) for col2 in ([pivot1],[pivot2]))as pvt Everything works fine. When I do this: select col1,[pivot1],[p...

0
голосов
2ответов
289 просмотров

dynamic tsql in sql 2005

Hi i am using the following dynamic sql: declare @cmd nvarchar(4000) set @cmd= 'select ''exec msdb.dbo.sp_update_job @job_id='''''' + convert(nvarchar(255), job_id)+ '''''', @owner_login_name=''''sa'''';'' from msdb..sysjobs' exec sp_executesql @cmd but all it is doing is printing as exe...

7
голосов
3ответов
837 просмотров

SQL Grouping around gaps

In SQL Server 2005 I have a table with data that looks something like this: WTN------------Date 555-111-1212 2009-01-01 555-111-1212 2009-01-02 555-111-1212 2009-01-03 555-111-1212 2009-01-15 555-111-1212 2009-01-16 212-999-5555 2009-01-01 212-999-5555 2009-01-10 212-999...

0
голосов
8ответов
3745 просмотров

Sync two SQL Server databases

I have two databases: the source is a database from SQL Server Express by client and the target is a database from SQL Server 2005 database as backup initially. What I need is to sync the source to the target db if there is any difference between them and the sync is one-way from source to target...

2
голосов
3ответов
1062 просмотров

Retrieving the Windows username from a logged-in machine through an intranet application

How can an application, running on a production server, access the login username of the machine that a user is accessing an application from? For example, I am currently logged into my machine on the INTRA corporate intranet. My username will be INTRA\Username. I have added specific usernam...

2
голосов
1ответов
2703 просмотров

SQL Server ContainsTable not finding partial matches

I'm trying to use ContainsTable to return a ranked list of results. I have it working fine when it finds a whole word match but its doesnt seem to work for partial words. For example if I search for 'acq' it wont find 'Acquisitions'. I really need it to work with partial matches for it to be us...

14
голосов
2ответов
15749 просмотров

SQL Server Agent Job Timeout

I have just had a scheduled SQL Server job run for longer than normal, and I could really have done with having set a timeout to stop it after a certain length of time. I might be being a bit blind on this, but I can't seem to find a way of setting a timeout for a job. Does anyone know the way ...

29
голосов
4ответов
21978 просмотров

newid() vs newsequentialid() What are the differences/pros and cons?

In a database where all of your primary keys are GUIDs, what are the differences/implications and/or pros and cons using newid() versus newsequentialid() as the "default value or binding". The only difference that I know of is that newid() creates a new random GUID as opposed to newsequentialid(...

1
голосов
4ответов
1808 просмотров

delete records from 2 tables

I have to write a query to delete form 2 tables DELETE FROM [Policies],[BackupSpec] WHERE [PolicyID] = @original_PolicyID PloicyID is PK in Policies and FK in Backupspec any suggestions?? SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.Connec...

2
голосов
2ответов
2238 просмотров

SQL Server 2005 Xquery namespaces

I'm trying to get some values out of an Xml Datatype. The data looks like: <Individual xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <FirstName xmlns="http://nswcc.org.au/BusinessEntities.Crm">Lirria</FirstName> &lt...

1
голосов
5ответов
2168 просмотров

How to select data using multiple times in the 'where' clause

I have two columns of data in a SQL 2005 DB Datetime Value '2009-10-29 10:00:00' ' 10.1' '2009-10-29 10:15:00' ' 10.2' '2009-10-29 10:30:00' ' 10.3' '2009-10-29 10:45:00' ' 10.4' I want to SELECT Value FROM [table] WHERE Datetime >= '2009-10-29 10:00:00' AND (Datetime NOT B...

0
голосов
2ответов
180 просмотров

How to make a log on relational-data in SQL-Server?

I need to create in my DB a log, that every action in the program should be written there. I will also want to store additional data to it for example have the table and row the action was applied to. In other words I want the log to be dynamic and should be able to refer to the other tables in ...

2
голосов
4ответов
3292 просмотров

SQL Server 2005 search views for certain database objects

Is there a way in SQL Server to list all the views within a database that join from a particular object? ie: find all the views that join from the table myTable