Skip to content

Tag: sql-server

Creating a VIEW in SQL-Server

I’m trying to create a VIEW in my database, and it shows me “Incorrent syntax error” Am I doing something wrong? Answer Include GO between your Create View and Select query (or) view should be the only statement.

Create a column from 2 columns of 2 different tables

I have these 2 tables. What I want is that LineTotal is equal to Quantity*Price. I know that if I have Price in my OrderLine I could do LineTotal as ([quantity]*[price]). But that’s not what I want. I also read something about triggers but it wouldn’t work due to errors. What I tried I use SQL Ser…

Encoding special characters SQL to R and back

I have a problem passing data from R to SQL and then reading it back The original data is from some excel files and have the following word: Průmyslový Using latin1 for encoding depreciates the u within the word Prumyslový Using latin2 for encoding changes the accent of the u Prùmyslový Which encoding could i…

SQL Select results based on two rows with different condition

I’m trying to fetch results where I want to check if two rows exist for a common ForeignKeyId and add a check on both rows. Suppose I have a table below – ‘Test1’ I want to fetch Result from Test2 table where Test1 should contain two rows where C = x and D <> NULL. So, select que…

Why aren’t these two attributes being filtered for?

I am writing an query that determines which courses were held in large lecture halls or auditorium type classrooms in Summer Quarter of 2016. When I execute it, it successfully filters for the Classroom Types of either Large Lecture or Audio but it doesn’t do the same for both Quarter and Year Sample Ou…