sql-server-2005

Generate XSD from 2005 SQL Server Database

What is the easiest method to generate an XSD schema from a 2005 SQL Server Database? Would it be possible to generate one XSD schema for the entire Database (~100 tables)? I searched online and found a SQL example that generates one XSD for the one table: DECLARE @schema xml SET @schema = (SELECT * FROM MyTableName FOR XML AUTO, ELEM...

Downgrading SQL server 2008 to SQL Server 2005

Are there any issues backing up a database from SQL Server 2008, and then importing it into SQL Server 2005? I had upgraded to SQL Server 2008, but 2008 seems to be too problematic so now I want to downgrade. Are there any problems in doing this? ...

SQL Server 2005 Delete Trigger select from deleted returns null

I have a table called hl7_lock in SQL Server with these columns: hl7_id lock_dtm lock_user I have 3 triggers on the table for UPDATE, INSERT, and DELETE The table is never updated, but INSERT trigger is working perfectly. However this delete trigger occasionally puts a record in hl7_lock_log with a null hl7_id SET NOCOUNT ON; de...

SQL Server Management Studio Display Database Diagrams (ER) Permissions

I was wondering if anybody knew exactly what permissions where needed on a database in SQL Server 2005+ so that when a person uses SQL Server Management Studio, they could then be able to at minimum see the Database Diagrams. I have tried giving the person db_datareader, db_datawriter, and db_ddladmin, but to no avail. I have also tr...

Grant user insert permission after create table command

What is the T-SQL syntax for granting a specific user only insert permission after a create table command? Here is my CREATE TABLE script: CREATE TABLE [dbo].[MyTable] ( [MyColumn1] [uniqueidentifier] NOT NULL, [MyColumn2] [char] (1) NULL ) ON [PRIMARY] ...

What is the use of maintance plans in SQLSERVER2005

Can anyone tell me what is the need and use of sqlserver maintanance plans and how to configure them. ...

what is DTS/SSIS in SQLSERVER?

Hi what is DTS/SSIS in sqlserver.Can i need to separately Insatll these services. what is use of this DTS/SSIS in sqlserver.How to configure these DTS/SSIS ??? Help me in this regard plzzzz Thanks in advance. ...

The user is not associated with a trusted SQL Server connection.

i wrote the code like this to connect sqlserver database.i load the driverclass,but iam not getting connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); System.out.println("class Loaded"); connection = DriverManager.getConnection("jdbc:sqlserver://10.171.160.114:2001","XXXXXX","XXXXXX"); ...

How to use Union method or left outer join?

i can not join #Temp with scr_SecuristLog. How can i do it? CREATE TABLE #Temp (VisitingCount int, [Time] int ) DECLARE @DateNow DATETIME,@i int,@Time int set @DateNow='00:00' set @i=1; while(@i<48) begin set @DateNow = DATEADD(minute, 30, @DateNow) set @Time = (datepart(hour,@DateNow)*60+datepart(minute,@D...

Count distinct and Null value is eliminated by an aggregate

I'm using SQL Server 2005. With the query below (simplified from my real query): select a,count(distinct b),sum(a) from (select 1 a,1 b union all select 2,2 union all select 2,null union all select 3,3 union all select 3,null union all select 3,null) a group by a Is there any way to do a count distinct without getting "Warning: Null...

How to generate this sql query?

"0" is VisitingCount ---Numeric Value Datepart, For example: 00:00--1, 00:30--2, 01:00--2, 01:30--3 CREATE TABLE #Temp (VisitingCount int, [Time] int ) DECLARE @DateNow DATETIME,@i int,@Time int set @DateNow='00:00' set @i=1; while(@i<48) begin set @DateNow = DATEADD(minute, 30, @DateNow) set @Time = (datepart...

BULK insert error with UNC path and windows Authentication

Hi, I have two servers, One is application server which has webservice and other server is a DB server,which has SQL server 2005 DB. Webservice is a vb.net app and all the input files will be on app server. When my application calls(through webservice) DB server to execute BULK insert statement with UNC path(of app server) using Windows...

How can evaluate more than once data from a query?

CREATE TABLE #Temp (VisitingCount int, [Time] int ) DECLARE @DateNow DATETIME,@i int,@Time int set @DateNow='00:00' set @i=1; while(@i<48) begin set @DateNow = DATEADD(minute, 30, @DateNow) set @Time = (datepart(hour,@DateNow)*60+datepart(minute,@DateNow))/30 insert into #Temp(VisitingCount,[Time]) va...

how to install sqlserver2005 evaluation on xp sp2 machine

Duplicate http://serverfault.com/questions/7541/how-to-install-sqlserver2005-evaluation-on-xp Hi I am unable to instal SQLSERVER2005 evaluation version on winXp service pack2 machine. iam getting the error such that error 87: dotnet framework 2.0 installation and parameter incorrect. Before run the sqlserver 2005 setup i hav i...

what is use of sqlserver analasys services in SQLSERVER2005

Hi What is the use of sqlserver analasys services in sqlserver2005??? where should we use analasys services? how to configure these analasys services?? Thanks in Advance ...

How to solve Conversion failed when converting the nvarchar value?

CREATE TABLE #Temp (VisitingCount int, [Time] int, [Date] nvarchar(50) ) DECLARE @DateNow DATETIME,@i int,@Time int, @Date nvarchar(50) set @DateNow='00:00' set @i=1; while(@i^60;48) begin set @DateNow = DATEADD(minute, 30, @DateNow) set @Time = (datepart(hour,@DateNow)*60+datepart(minute,@DateNow))/30 s...

How can i evaluate this table?

i need second table. CREATE TABLE #Temp (VisitingCount int, [Time] int, [Date] nvarchar(50) ) DECLARE @DateNow DATETIME,@i int,@Time int, @Date nvarchar(50) set @DateNow='00:00' set @i=1; while(@i<48) begin set @DateNow = DATEADD(minute, 30, @DateNow) set @Time = (datepart(hour,@DateNow)*60+datepart(minute,@...

Efficent way to set date using week of month value

I have a week of month in sql and i need to generate a datetime varible from that.. fields i have are dayofweek, weekofmonth and month values. anyone know of a quick effective way to calculate this in mssql 2005? Thanks Keep in mind. if week of month is set to 5 it is the last week of the month Examples are i have DayOfWeek, month, yea...

How can i change dataset cell format

if i use this query thath creates a table(look Table1), But VisitingGap column is not correct format. i used cast method to give format. But not working correctly.i need Table2 declare @date1 nvarchar(100) , @date2 nvarchar(100) , @countgap int,@count int set @date1='2009-05-12' set @date2 = '2009-05-13' set @countgap = 30 set @count=...

How to call SQL Server Management Studio's Query Designer from C# application

Hello all, Is it possible to call SQL Server Management Studio's Query Designer form from C# application? I am using SQL Server Management Studio 2005 Express Version. I have added some of the Management Studio's assemblies in my project (e.g. Microsoft.SqlServer.Smo), but could not found related classes to open 'Query Designer'. Hope...