How to auto increment in vb form

I am using and SQL Server as backend; I want to auto generate id which is created as primary key and is there any way to auto generate id with alphanumeric ex:- cx10001,cx1002

How to check if the result of a query is equal to one of the results from another query in SQL?

My target query returns either 1s or 0s depending on whether certain conditions are met: SELECT TOP 1 ISNUMERIC(LEFT(Attachment, 4)) as Column1, ISNUMERIC(SUBSTRING(Attachment, 5, 4)) as Column2 –Column3 to be included FROM Table1 As of now, the results are: Column1|Column2 1 0 I want to include Column3 into my target query. The result I want […]

SQL query runs into a timeout on a sparse dataset

For sync purposes, I am trying to get a subset of the existing objects in a table. The table has two fields, [Group] and Member, which are both stringified Guids. All rows together may be to large to fit into a datatable; I already encountered an OutOfMemory exception. But I have to check that everything […]

Anybody know why SQL Server 2005 throws “'SQLOLEDB' failed with no error message available, result code: E_FAIL(0x80004005). ”?

We’ve got a web system running SQL Server 2005 for the back end, and ASP.Net for the front end (using .net 2.0). Every now and then, the system barfs out the error in the title: ‘SQLOLEDB’ failed with no error message available, result code: E_FAIL(0x80004005). The web system runs just fine 24/7, and then every […]

SQL Server: similar records based on 2 detail tables

I need to find similar records in SQL Server 2016, and it would be great if I could order result by how much they match. Match criteria for similar are 2 detail tables. My table structures are: //Basic: Id Title 1 Title 1 2 Title 2 3 Title 3 4 Title 4 5 Title 5 […]

SQL Partition by to get sandwiched totals?

Have a list of data that i want the running sums of between zeros. I thought I could do this with Partition by. So the example below ID Date MyVar 2083 2016-04-20 1 — 2 2083 2015-03-19 1 — 1 2083 2015-01-20 0 —- resets 2083 2014-12-15 1 —-4 2083 2014-11-10 1 —-3 2083 2014-10-22 […]

Low performance with linq and INTERSECT/EXCEPT in small collections

how are you? I know there are plenty of questions and answers about it, but my case is quite particular because I dont have large arrays to intersect. I am implementing a search method that receives a search object and, using linq, searchs into the DB (I am using EF 6 with code first). So, […]

powershell command to restore remote database

Does anyone know the powershell commands to restore a remote database from a local file?

SQL: Updating a user ordered sequence of items within a group

A table for storing items, in a particular order, associated with a container. Separate ak_* constraints involving item_id and seq ensure a container contains distinct items and the sequence of those items is distinct. CREATE TABLE [container_items] ( [container_item_id] INT IDENTITY (1, 1) NOT NULL, [container_id] INT NOT NULL, [item_id] INT NOT NULL, [seq] INT […]

Can you import a SQL file into a SQL 2005/8 script?

If I have scripts in multiple files, and I would like to execute each one in a known sequence, can I simply import them into a T-SQL script and execute them, or must I run sqlcmd or similar against each file? I’m sure Oracle has a feature to import/include script content from another file (maybe […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.