How to create RowNum column in SQL Server?
In Oracle we have "rownum". What can I do in SQL Server? ...
In Oracle we have "rownum". What can I do in SQL Server? ...
Hello, I am developing an SSRS 2008 report which contains a number of simple charts. On the x axis I have the 12 months of this year - Jan 2009 thru December 2009. On the Y is an integer value ranging from 0 to 100 in increments of 10. I am plotting the number of times an issue occurred per month. So January could have a value of 10, Feb...
Is there any way to configure a SQL server instance to not permit updates to values inserted in the database? e.g. once inserted, the value is fixed, other columns in that same row may be changed, but that value is only written once. ...
Hi, I have a table in a sql server 2008 database that contains bunch of records as well as a date column. The date is inserted automatically when a new entry to the table occurs. So, it contains the date of the record that has been created. I am trying to run a query that would return me the earliest date and the latest date in this t...
We are trying to have a transactional table that only takes new records inserted on a regular basis. This simple table requires us to continuously add new records to it over time. The volume of transactions into this table is expected to be quite high, and also there might be periodical batch imports of transactions (>1000) that may ta...
I have a SQL column with length of 6. Now want to take only first char of that column. Is the any string function in SQL to do this? ...
I have 100 records in which i can select top 10 using the "TOP 10" in the query. Similarly is there anything to get the 20th to 30th record? ...
Dear all, I have a view V in database D1 on which an update trigger U is defined that updates three tables T1, T2 and T3 in database D2. Those three tables contain 0.75, 6.0 & 4.5 million records. The Sql Server version is 9.0.3042, Developer Edition. When I perform the following update statement on the above view it is ready within on...
I am creating a job such that executes the following SQL statement. select * from emp where sal > 5000 It is scheduled to execute on 3 PM every day. Now my question is: How to configure mail or alert such that when the job executes I have to receive a mail or alert indiactes query executed suceesully ...
I am using SQL2000 and I would like to join two table together based on their positions For example consider the following 2 tables: table1 ------- name ------- 'cat' 'dog' 'mouse' table2 ------ cost ------ 23 13 25 I would now like to blindly join the two table together as follows based on their order not on a matching columns (I ...
I've seen this abbreviation (or mnemonic) used in various examples in SQL and web services. What does it mean? And if you know, what are its origins? ...
I have a client with a .Net 1.0 web app that uses IIS and a SQL 2000 database. It is hosted with a shared hosting service and does get not much traffic (a few visitors a day tops). The hosting has occasional downtime, of course, and the client has asked me if I can setup a redundant system to reduce downtime to negligible. What is the s...
Hi! I have created a linkedserver as ravikiran-vm which is the virtual machine in my desktop. Now I have a database called kiran which contains an employ table. To retrieve employ data, I do the following: select * from ravikiran-vm.kiran.employ but it shows the error "Incorrect syntax near '-'." Can anyone help me, please? Thanks...
We use calculated columns in a few SQL Server 2005 tables which always return data of a specific type (bit, varchar(50), etc...). These tables are consumed by a .NET data layer using strongly-typed datasets and tableadapters, however since the calculated columns are not constrained to a specific type (we always return a specific type, b...
I need to saving strings in database. Each string has different size from 1 to N. I think that limit will be about 10000, maybe more. nvarchar(MAX) will be best way to resolve this ? ...
Hi, With sql Server 2005. I have declared a trigger that get fired "AFTER INSERT, UPDATE" , in this trigger I'm using a WHILE and a CURSOR to loop on the INSERTED table's rows. When I find a row that does not sotisfy a specific condition: I want the trigger to rise an error and do not insert any of the rows that fired the trigger (not e...
How do I connect to a named instance of a linked SQL server. If its not linked, I would do the following: ServerName.DatabaseName.dbo.TableName If it is linked, I would assume the following: ServerName\InstanceName.DatabaseName.dbo.TableName but SQL doesn't like the "\" What is the correct syntax ...
Anyone know a simple query to grab a list of all stored procedures in a SQL 2005 database ordered by createdate? ...
I have an old compiled Access Application mde file. This appication has linked tables to network shared folder. I tried to upgrade main database using upsizing wizard on main database and everything went well. Then when the aplication starts it gives error message that 'microsoft jet database engine cannot find the input table or query ...
I'm trying to programmatically add an identity column to a table Employees. Not sure what I'm doing wrong with my syntax. ALTER TABLE Employees ADD COLUMN EmployeeID int NOT NULL IDENTITY (1, 1) ALTER TABLE Employees ADD CONSTRAINT PK_Employees PRIMARY KEY CLUSTERED ( EmployeeID ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP...