How to Create Trigger to Keep Track of Last Changed Data

CREATE TABLE Member ( memberID – PK memberName dateRegistered – one time process ); CREATE TABLE MemberLastChanged ( memberID memberName dateEntered ); If by any chance a user changes his member name, i need to keep track of the currently changed memberName in a history table. For example, current info is: memberID: 5534 memberName: james […]

Query two databases with Oracle SQL Developer

Is there a way to query two databases (in a single query) in Oracle SQL Developer? I’m not very familiar with Oracle — aside from standard CRUD syntax at any rate. I’m trying to do an insert into an Oracle table from a SQL Server table. Would like to do something like this: INSERT INTO […]

Connecting jQuery with the SQL Server Database

I am trying to build a jQuery functionality for which the scenario is given below. Consider a user clicks on an image in the website, a jQuery dialogue box pops up on the page. The dialogue box has a text field to enter the ‘alternative text’ for the image. When the user clicks on the […]

Why can't I create this sql server full text index?

I have a database table with the primary column defined as: ID bigint identity primary key I also have a text column MiddlePart. I’m trying to create a full text index, like so: CREATE FULLTEXT INDEX ON domaining.dbo.DomainName ( MiddlePart Language 0X0 ) KEY INDEX ID ON domaincatalog WITH CHANGE_TRACKING AUTO I get this error: […]

Calling a stored procedure with

If I have a connection string defined in my web.config file, how do I create a connection to the SQL db from C# code (sorry forgot to specify) and then call a stored procedure. I would then like to eventually use this data in some way as my DataSource for a GridView. Here is how […]

Selecting Values From a table as Column Headers

I have a table ‘propertyvalues’ as follows: ID FileID Property Value 1 x Name 1.pdf 2 x Size 12567 3 x Type application/pdf 4 y Name 2.pdf 5 y Size 23576 6 y Type application/pdf …… and so on How to write a SQL query on the table above to fetch a result like below […]

NULL values are excluded. Why?

This is about a bizarre behaviour I found in Microsoft Sql Server. Please correct me if I’m wrong. SELECT COUNT(*) FROM TABLEA WHERE [Column1] IS NULL; This returns 30018 rows. CREATE VIEW VIEWB AS SELECT * FROM TABLEA AS t1 WHERE t1.[Column1] NOT IN (‘Cross/Up sell’, ‘Renegotiation’, ‘Renewal’) If I check VIEWB, I don’t find […]

Setting database name as a variable in SQL

currently, I’m doing a bit of a data migration between one db to another based on some business rules. I have this huge script that I’m writing where I’m referencing both databases a lot of times. The problem is that this data migration is currently in development, at some point I am going to want […]

SQL – create database and tables in one script

Sorry if already asked, but I can’t find anything on this. I am moving something over from MySQL to SQL Server I want to have a .sql file create a database and tables within the database. After working out syntax kinks I have gotten the files to work (almost). If I run IF db_id(‘dbname’) IS […]

Concatenate Message In RAISERROR

What’s the proper syntax here? If (@timestamp < (Select PromoStartTimestamp From @promo)) RAISERROR(‘Code not valid until ‘ + (Select PromoStartTimestamp From @promo) ,16 ,1); I’ve tried: If (@timestamp < (Select PromoStartTimestamp From @promo)) RAISERROR(N’Code not valid until @starttimestamp’ ,16 ,1 ,(Select PromoStartTimestamp From @promo)); Michael Fredrickson’s answer gives me an error of Incorrect syntax near […]

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